isNaN(NaN) // true
typeof(NaN) // 'number'
function foo() {
{
var x = 5
let y = 6
const z = 7
}
console.log(x)
console.log(y)
console.log(z)
}
foo() // 5, undefined, undefined
Variables without any qualifier (var
, let
/const
) are automatically in the global scope (after executing the block)
console.log(x) // x is not defined
function foo() {
x = 5
}
// x is still not defined
foo()
console.log(x) // 5