Why does typeof let return 'undefined' and is not throwing an SyntaxError instead?
console.log(typeof let);
The unary typeof operator expects an expression. Am I missing something about the let statement?
The typeof operator is treating let as a undeclared variable.
See more in MDN docs.
Look at this with an undeclared variable.
console.log(typeof elefromstack)
In strict mode, an error is thrown.
'use strict'
console.log(typeof let);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With