Question Bank

JavaScript Coercion and Equality Code Traces

Difficulty: Easy

Six output traces drilling on `==` vs `===`, unary `+`, falsy values, and chained relational coercion. Sharpens the rules JS applies before comparing.

Question Bank
/

JavaScript Coercion and Equality Code Traces

JavaScript Coercion and Equality Code Traces

Six output traces drilling on `==` vs `===`, unary `+`, falsy values, and chained relational coercion. Sharpens the rules JS applies before comparing.

Question Bank
Easy
JavaScript
6 questions
quiz
interview-prep
fundamentals
js-language

440 views

10

What does the following code print?

Examples

Example 1:

Input: console.log(a == b); console.log(a === b);
Output: false; false
Explanation: Arrays are objects, so both == and === compare by reference identity, and a and b are two distinct array instances.