Skip to content

OutputNot attempted

Loose equality table

console.log(0 == '', 0 == '0', '' == '0', false == 'false', false == '0', undefined == null, undefined == 0);

Spaces and quote style don’t matter · write a thrown error as TypeError

Ctrl Enter
Show answer & explanation

The expected output comes from actually running the snippet; opening this shows it next to the explanation.

string vs number → string becomes a number. boolean → number first. "" vs "0" are two strings, compared as-is (no conversion). "false" → NaN. null/undefined only equal each other.