0
how to join words in javascript. i don't understand the code below.
var a = "8a"; var b = 8; if (a<b) { document.write(a + " is less than " + b)
1 Resposta
+ 1
You can compare a string to a number only if the string's all letters are digits. For example,
8 == "8"
8 < "18"
"7" > 3
will all return true.
In the given code, the string is not fully composed of digits, so a < b will always be false and thus the code inside the if block will never be run.