Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

162
Vistas
Why does this expression result in `ReferenceError`?

Why does incrementing the same thing behave differently when I reference it via a variable?

function f() {
    return {};
}

let x = {};
x++; // OK
(f())++ // ReferenceError
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

The difference is due to that when js is evaluating the expression it starts by checking if the left hand side is convertible to a number and by quirkyness an object is converted to Nan whereas a function is is not and js throws an exception when trying to convert it before it is evaluated. See also here: https://tc39.es/ecma262/multipage/ecmascript-language-expressions.html#sec-postfix-increment-operator

about 4 years ago · Juan Pablo Isaza Denunciar

0

This whole code doesn't make any sense. You cannot increment a object.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda