Javascript Weird Parts [patched]
You try to parse an integer from a string like "hello" . You get NaN (Not-a-Number). You ask JavaScript what type it is:
const arr = [1, 2, 3]; const obj = { a: 1 };
function foo(a, b) { console.log(arguments); // outputs an array-like object console.log(a, b); // outputs the actual arguments } javascript weird parts
But:
JavaScript uses the same symbol for addition concatenation. But it chooses based on... vibes? You try to parse an integer from a string like "hello"
const obj = { show }; obj.show(); // obj
false , 0 , -0 , 0n (BigInt zero), "" , null , undefined , NaN . b) { console.log(arguments)
Empty array and empty object? Truthy. But if ([] == false) ? That’s true (see point #2). Consistency? Not today.