[Solved] Can someone explain what this JS snippet is doing?


The code

 var x = false;
 var y = x === true;
 console.log(y);

is simply checking the condition x === true, like other programming language it will result to either true or false. Since you have var x = false; the condition x === true will result in false as false === true is always false. Now, the result of this condition is being assigned to the new variable y as var y = x === true; so the value for y will be false.

1

solved Can someone explain what this JS snippet is doing?