Skip to content

Instantly share code, notes, and snippets.

@FurkanKozen
Created May 15, 2020 11:34
Show Gist options
  • Save FurkanKozen/7f5991a9c26f2265247b895db6dc8885 to your computer and use it in GitHub Desktop.
Save FurkanKozen/7f5991a9c26f2265247b895db6dc8885 to your computer and use it in GitHub Desktop.
How this code writes "banana" to console?
console.log(("b" + "a" + + "b" + "a").toLowerCase()); //writes banana to console
//Explanation:
//The key point is + "b"
//+ is 'unary plus operator' that can be used to convert a variable to a number
//when "b" is converted to number, its value would be NaN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment