Behavior of () => {'use strict'; return typeof this }

# David Bruant (12 years ago)

Should the "use strict" directive work inside an arrow function? Currently, for () => {'use strict'; return typeof this } returns 'object' in Firefox (it's the global object). Is it the intended behavior?

# David Bruant (12 years ago)

Le 06/06/2013 12:49, David Bruant a écrit :

Hi,

Should the "use strict" directive work inside an arrow function? Currently, for () => {'use strict'; return typeof this } returns 'object' in Firefox (it's the global object). Is it the intended behavior?

Yeah... Don't bother answering. lexical this. Appologies for the noise.

# Andrea Giammarchi (12 years ago)

which means it breaks explicit 'use strict' directive so, in my opinion, is a legit question or, at least, this should be mentioned in the MDN page ?

# Andrea Giammarchi (12 years ago)

and for "it breaks" I meant "it feels broken" ... this is not a real issue but MDN should mention it to avoid any sort of confusion. I'll edit that page,

# Andrea Giammarchi (12 years ago)

feel fere to update/change/improve my quick note in that page, thanks.

developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/arrow_functions