S10.2.1_A2.js (895B)
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: | 6 If two or more formal parameters share the same name, hence 7 the same property, the corresponding property is given the value that was 8 supplied for the last parameter with this name 9 es5id: 10.2.1_A2 10 description: > 11 Creating functions initialized with two or more formal parameters, 12 which have the same name 13 flags: [noStrict] 14 ---*/ 15 16 //CHECK#1 17 function f1(x, x) { 18 return x; 19 } 20 if(!(f1(1, 2) === 2)) { 21 throw new Test262Error("#1: f1(1, 2) === 2"); 22 } 23 24 //CHECK#2 25 function f2(x, x, x){ 26 return x*x*x; 27 } 28 if(!(f2(1, 2, 3) === 27)){ 29 throw new Test262Error("f2(1, 2, 3) === 27"); 30 } 31 32 //CHECK#3 33 function f3(x, x) { 34 return 'a' + x; 35 } 36 if(!(f3(1, 2) === 'a2')){ 37 throw new Test262Error("#3: f3(1, 2) === 'a2'"); 38 } 39 40 reportCompare(0, 0);