null-not-zero-index.js (300B)
1 // |jit-test| --no-threads 2 3 function f(index) { 4 var a = [123]; 5 return a[index] 6 } 7 8 function g() { 9 for (var i = 0; i < 100; i++) { 10 // Make sure |null| is not treated like a |0| index. 11 assertEq(f(i > 90 ? null : 0), i > 90 ? undefined : 123) 12 } 13 } 14 15 for (var j = 0; j < 10; j++) { 16 g(); 17 }