[X]

Banana

luljs still works

Spell the word banana out of string concatenation and one stray plus sign.

In 2026: Still works. The `+ +"a"` in the middle is a unary plus applied to the string "a", which coerces it to NaN. So the pieces join as "b" + "a" + NaN + "a", spelling baNaNa, and toLowerCase lowers it.

Where it came from: A coercion gag collected in the wtfjs list. It rests on the unary + operator turning a non-numeric string into NaN. MDN

<script>
var out = ("b" + "a" + + "a" + "a").toLowerCase();
document.write("<h2 style='font-family:sans-serif'>" + out + "</h2>");
document.write("<p><code>(\"b\" + \"a\" + + \"a\" + \"a\").toLowerCase()</code></p>");
document.write("<p>The <code>+ +\"a\"</code> is a unary plus on \"a\", which is <b>NaN</b>, so it spells <b>baNaNa</b>.</p>");
</script>
sandboxed demo · breaks nothing but itselfrestart

More in luljs

all 63 in luljs › · the whole library ›