Created
September 18, 2010 09:27
-
-
Save arrix/585524 to your computer and use it in GitHub Desktop.
Opera javascript bugs
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></head> | |
<body> | |
<p>Most bizzare JavaScript bug in Opera 10.62 build 8437 (Mac OS X 10.6.4). Observable only without Dragonfly. Open error console to see the output.</p> | |
<script type="text/javascript"> | |
(function () { | |
var list = Array(50).join(' ').split('').map(function(n){return 1;}); | |
for (var i = 0, a, l = list.length; a = list[i], i < l; i++) { | |
var x; | |
if (i == l - 1) { | |
x = a; | |
//console.log(i, x) | |
} | |
if (x == 1 && x == undefined) { | |
console.log('Impossible!'); | |
break; | |
} | |
//the bug is not visible if the following code block is commented | |
if (i == l - 1) { | |
console.log('a =', a, 'x =', x, 'but a == x is', a == x); | |
break; | |
} | |
} | |
})(); | |
</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
(Array(3)).map(function(e){return 1;})[0] != 1 //always true in Opera 10.62 (OS X 10.6.4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment