Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

99
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!