JavaScript_Tricky_Questions_Sample
JavaScript_Tricky_Questions_Sample
Answer: "[object Object]". An empty array is coerced to an empty string, and {} is coerced to "[object
Object]".
Answer: 0. The expression is interpreted as a code block and unary plus applied to an empty array.
Answer: 'number'. NaN stands for 'Not a Number' but is actually of type 'number'.
8. What is hoisting?
Answer: Variables and function declarations are moved to the top of their scope during compilation.
9. Is 'var x = y = 1;' valid? What does it do?
Answer: Yes. y becomes a global variable (if not in strict mode). x is declared with var.