Created
May 23, 2019 19:40
-
-
Save raghu-icecraft/3ac72892ce9d19ee1d7b449dd965addd to your computer and use it in GitHub Desktop.
Revisions
-
raghu-icecraft created this gist
May 23, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ <!-- Comment 1. {} == 3 or {} === 3 comparision when tried in any modern browser console yields in error And the same comparision when done using if block works well and goes to else part of the code. 2. Further, use the below html file to understand the comparision like in Runtime. Sample output: display x: 21 Code is edited after initial reference from https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_oper_add --> <!DOCTYPE html> <html> <body onload="myFunction()"> <p>Display x:</p> <p id="demo"></p> <script> function myFunction() { var x = 0; if ({} == 3) { x = 5; } else { x = 21; } document.getElementById("demo").innerHTML = x; console.log("hello"); } </script> </body> </html>