+ 1
Why is the boolean out of this code in JavaScript
"green"==" green" and "green"<" green"
2 RĂ©ponses
0
"green" does not equal to " green" due to the space, "green" < " green" is undefined and will give you an error.
0
Eldar Bakerman JS will compare the corresponding charcode of each string first character. "g" has a charcode of 103, and "<space>" has a charcode of 32. The output is false, not undefined, and no error is thrown.
let a = "green" == " green" // False
let b = "green" < " green" // False
let c = a && b // False
Not sure what the question means by "boolean out of this code" though.