Skip to content

Instantly share code, notes, and snippets.

@jesboat
Created August 19, 2012 03:22
Show Gist options
  • Save jesboat/3391537 to your computer and use it in GitHub Desktop.
Save jesboat/3391537 to your computer and use it in GitHub Desktop.
This exhibits a bug in Chrome's JS engine
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<title>Rawr</title>
<p>JS follows
<pre>
<script type="text/javascript">
function wr(str) {
document.write(str + "<br>");
}
var a = {valueOf: function(x) { wr("a"); return 1; }};
var b = {valueOf: function(x) { wr("b"); return 2; }};
wr("less than is");
wr(a < b);
wr("greater than is");
wr(a > b);
</script>
</pre>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment