JS Built-ins
StrictModebeginner

this Binding in Strict Mode

this Binding in Strict Mode

In strict mode, this inside a regular function called without a context is undefined (not the global object). This prevents accidental global pollution.

Challenge: Write getThisValue() that:

  1. Uses 'use strict' directive at the top
  2. Returns the value of this in that strict mode function
πŸ’‘ Hints (2)
  • β€’ In strict mode, this is undefined in a regular function call
  • β€’ No need for eval here β€” just use use strict at function top