I have been studying JavaScript lately, but I am not getting the [undefined] - x something is -x but undefined - x is NaN...
console.log(undefined-3); //NaN
console.log([undefined]-3); // -3
I have been studying JavaScript lately, but I am not getting the [undefined] - x something is -x but undefined - x is NaN...
console.log(undefined-3); //NaN
console.log([undefined]-3); // -3
The explanation : (Give your feedback)
Before the calculation, the compiler will try to convert "undefined" and "[undefined]" to a typeof number.
And the result is :
Check the list of JavaScript type Conversion here.