Created
May 15, 2020 11:34
-
-
Save FurkanKozen/7f5991a9c26f2265247b895db6dc8885 to your computer and use it in GitHub Desktop.
How this code writes "banana" to console?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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