var x = 42; var y = "42"; if (x === y) { alert("x is equal to y with a simple test."); } else { alert("x is not equal to y"); }
The sample code for equality uses the stricter test, = = =. This code examines the values, but unlike the simpler test, the stricter test also tests variable types. Since variable x is a number and variable y is a string, this equality test fails.
NOTE:Try with x == y condtion, then you will know the difference.
|
No responses found. Be the first to respond and make money from revenue sharing program.
|