S13_A18.js (1056B)
1 // Copyright 2009 the Sputnik authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 info: Closures are admitted 6 es5id: 13_A18 7 description: Using a function declaration as a function parameter 8 ---*/ 9 10 ////////////////////////////////////////////////////////////////////////////// 11 //CHECK#1 12 if (typeof sinx !== 'undefined') { 13 throw new Test262Error('#1: typeof sinx === \'undefined\'. Actual: typeof sinx ==='+typeof sinx); 14 } 15 // 16 ////////////////////////////////////////////////////////////////////////////// 17 18 var __val = function derivative(f, dx) { 19 return function(x) { 20 return (f(x + dx) - f(x)) / dx; 21 }; 22 }(function sinx(x){return Math.sin(x);},.0001)(0.5); 23 24 ////////////////////////////////////////////////////////////////////////////// 25 //CHECK#2 26 if (typeof sinx !== 'undefined') { 27 throw new Test262Error('#2: typeof sinx === \'undefined\'. Actual: typeof sinx ==='+typeof sinx); 28 } 29 // 30 ////////////////////////////////////////////////////////////////////////////// 31 32 reportCompare(0, 0);