Assuming you have a browser that supports both labeled function declarations and block statements, what is the standard way/method for browsers to determine if the following is an object with a property named L
that is function F
, or a block that contains function F
labeled as L
:
{
L: function F(){}
}
E.g.
To expose what I mean, here are two different copies of the above code modified to expose it as an array and as a function:
document.body.textContent = typeof( () => {
L: function F(){}
} )
In the above code, the browser recognizes the arrow function notation and determines that it is a block statement. However,
document.body.textContent = typeof {
L: function F(){}
}
The above code makes the browser think that it is an object written out as an object literal with index L
being function F