|
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 * Function declaration in function code - If the variable object |
|
6 * already has a property with the name of Function Identifier, replace its |
|
7 * value and attributes. Semantically, this step must follow the creation of |
|
8 * FormalParameterList properties |
|
9 * |
|
10 * @path ch10/10.2/10.2.1/S10.2.1_A4_T2.js |
|
11 * @description Checking existence of a function with declared variable |
|
12 */ |
|
13 |
|
14 //CHECK#1 |
|
15 function f1(){ |
|
16 var x; |
|
17 |
|
18 return x; |
|
19 |
|
20 function x(){ |
|
21 return 7; |
|
22 } |
|
23 } |
|
24 if(!(f1().constructor.prototype === Function.prototype)){ |
|
25 $PRINT('#1: f1() returns function'); |
|
26 } |
|
27 |
|
28 //CHECK#2 |
|
29 function f2(){ |
|
30 var x; |
|
31 |
|
32 return typeof x; |
|
33 |
|
34 function x(){ |
|
35 return 7; |
|
36 } |
|
37 } |
|
38 if(!(f2() === "function")){ |
|
39 $PRINT('#2: f2() === "function"'); |
|
40 } |
|
41 |