Javascript: Weird Parts
Put { on the same line as return . 6. this – The Shape-Shifter In most languages, this is predictable. In JavaScript, it depends on how you call the function.
console.log(NaN === NaN); // false Yes, NaN is not equal to itself. You must use Number.isNaN() instead. This is the gateway drug of JS weirdness. javascript weird parts
If you’ve spent more than 48 hours with JavaScript, you’ve probably uttered the phrase: “Wait… why did it do that?” Put { on the same line as return
false , 0 , -0 , 0n (BigInt zero), "" , null , undefined , NaN . this is predictable. In JavaScript
English
Español
Русский
Deutsch
Français
العربية
Italiano
Türkçe
Polski
Português
Indonesia
日本語
en