Skip to content

Instantly share code, notes, and snippets.

@andreazevedo
Created August 16, 2011 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreazevedo/1148296 to your computer and use it in GitHub Desktop.
Save andreazevedo/1148296 to your computer and use it in GitHub Desktop.
Odd NaN feature in JavaScript
<html>
<head>
<script>
function printLine(content) {
if (content) {
document.body.innerHTML += content;
}
document.body.innerHTML += "<br/>";
}
function main() {
var x = 0 / 0;
var result = (x == x);
printLine(result);
}
</script>
</head>
<body>
<script>
main();
</script>
</body>
</html>
@andreazevedo
Copy link
Author

This gist is related to the following article: http://andreazevedo.org/2011/08/15/odd-nan-feature-in-javascript/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment