1 /** 2 File Name: statement-004.js 3 Corresponds To: 12.6.3-1.js 4 ECMA Section: 12.6.3 The for...in Statement 5 Description: 6 Author: christine (at) netscape.com 7 Date: 11 september 1997 8 */ 9 var SECTION = "statement-004"; 10 var VERSION = "JS1_4"; 11 var TITLE = "The for..in statment"; 12 13 startTest(); 14 writeHeaderToLog( SECTION + " "+ TITLE); 15 16 var testcases = new Array(); 17 var tc = 0; 18 19 var result = "Failed"; 20 var exception = "No exception thrown"; 21 var expect = "Passed"; 22 23 try { 24 var o = new MyObject(); 25 26 eval("for ( \"a\" in o) {\n" 27 + "result += this[p];\n" 28 + "}"); 29 30 } catch ( e ) { 31 result = expect; 32 exception = e.toString(); 33 } 34 35 testcases[tc++] = new TestCase( 36 SECTION, 37 "bad left-hand side expression" + 38 " (threw " + exception +")", 39 expect, 40 result ); 41 42 test(); 43 44 45 function MyObject() { 46 this.value = 2; 47 this[0] = 4; 48 return this; 49 } 50