function-tosource-statement.js (487B)
1 function f1(a, b) { 2 return a + b; 3 } 4 assertEq(f1.toString(), "function f1(a, b) {\n return a + b;\n}"); 5 if (Function.prototype.toSource) { 6 assertEq(f1.toSource(), f1.toString()); 7 } 8 function f2(a, /* ))))pernicious comment */ b, 9 c, // another comment(( 10 d) {} 11 assertEq(f2.toString(), "function f2(a, /* ))))pernicious comment */ b,\n c, // another comment((\n d) {}"); 12 function f3() { } 13 assertEq(f3.toString(), "function f3() { }");