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

104
Vistas
Why is toString always running in strict mode?

I know that according to ECMAScript specification, non-strict methods will have thisArg transformed to the global object, if null or undefined was passed to them. That's the reason this code logs the window object (in browsers) instead of null:

function x() {
    console.log(this);
}
x.call(null);

What I don't understand, is why doing the same thing with Object.prototype.toString.call(null), doesn't transform null to the global object, but keeps it as null and returns the string [object Null].

Is it because 'use strict' is used in default implementation of toString method? Is every built-in method run in strict-mode?

I couldn't find anything like that in the specification a https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.prototype.tostring.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Is every built-in method run in strict-mode?

Yes. It says so in §10.3 Built-in Function Objects:

"Built-in functions that are ECMAScript function objects must be strict functions."

This not only implies non-sloppy handling of the this argument, but also that these functions have no .arguments, .callee and .caller properties.

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