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

23rd Aug 2020, 2:26 PM
Allamprabhu Hiremath
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
23rd Aug 2020, 2:35 PM
Himanshu Shah
Himanshu Shah - avatar
+ 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
23rd Aug 2020, 3:09 PM
Marcel
Marcel - avatar