Skip to content

Instantly share code, notes, and snippets.

@arrix
Created September 18, 2010 09:27
Show Gist options
  • Save arrix/585524 to your computer and use it in GitHub Desktop.
Save arrix/585524 to your computer and use it in GitHub Desktop.
Opera javascript bugs
<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>
(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