0
Confusion in JavaScript
var a = 13 var b = 20 a=a==b console.log(a) Why this code output false and I can't understand a=a==b. Please answer me
2 ответов
+ 2
Allamprabhu Hiremath because
a=a==b means value assign to a and b is same if it is same then it gives true if it not then false
+ 1
The "==" is to compare. So you are comparing 13 and 20 it's like you say "is 13 equal to 20?" The answer is false.
At line 3 you are assigning "false" value to the variable "a".
a = is 13 equal to 20?
a = false