Created
October 7, 2015 12:02
-
-
Save anonymous/dda13eac813c57b55fbb to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/bunoje
This file contains 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 characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
var testStr = function () { | |
var a = "5"; | |
var b = "44"; | |
return a > b; // true, lex comparison | |
}; | |
console.log("num str", testStr()); | |
var testArray = function () { | |
var a = [1]; | |
var b = [1]; | |
return a == b; // false, obj references | |
}; | |
console.log('arrays', testArray()); | |
var testEmpty = function () { | |
var a = 0; | |
var b = []; //"" | |
return a == b; // true, both coerced to num when either is num | |
}; | |
console.log('empty things', testEmpty()); | |
var testEmpty = function () { | |
var a = ""; | |
var b = false; | |
return a == b; // true, both coerced to bool when both bool | |
}; | |
console.log('bools', testEmpty()); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var testStr = function () { | |
var a = "5"; | |
var b = "44"; | |
return a > b; // true, lex comparison | |
}; | |
console.log("num str", testStr()); | |
var testArray = function () { | |
var a = [1]; | |
var b = [1]; | |
return a == b; // false, obj references | |
}; | |
console.log('arrays', testArray()); | |
var testEmpty = function () { | |
var a = 0; | |
var b = []; //"" | |
return a == b; // true, both coerced to num when either is num | |
}; | |
console.log('empty things', testEmpty()); | |
var testEmpty = function () { | |
var a = ""; | |
var b = false; | |
return a == b; // true, both coerced to bool when both bool | |
}; | |
console.log('bools', testEmpty()); | |
</script></body> | |
</html> |
This file contains 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 characters
var testStr = function () { | |
var a = "5"; | |
var b = "44"; | |
return a > b; // true, lex comparison | |
}; | |
console.log("num str", testStr()); | |
var testArray = function () { | |
var a = [1]; | |
var b = [1]; | |
return a == b; // false, obj references | |
}; | |
console.log('arrays', testArray()); | |
var testEmpty = function () { | |
var a = 0; | |
var b = []; //"" | |
return a == b; // true, both coerced to num when either is num | |
}; | |
console.log('empty things', testEmpty()); | |
var testEmpty = function () { | |
var a = ""; | |
var b = false; | |
return a == b; // true, both coerced to bool when both bool | |
}; | |
console.log('bools', testEmpty()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment