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