forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuiltInApplyTarget.js
More file actions
50 lines (40 loc) · 1.18 KB
/
builtInApplyTarget.js
File metadata and controls
50 lines (40 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
function foo(arr)
{
WScript.Echo(Math.min.apply(Math, arr));
WScript.Echo(Math.max.apply(Math, arr));
WScript.Echo();
}
var arr = [{}, 3, 3.4, , new Array()];
var intArr = [1,2,3,4,5];
var floatArr = [1.2,2.3,3.4,4.5,5.6];
foo(arr);
foo(arr);
WScript.Echo("Testing int array");
foo(intArr);
//missing value
len = intArr.length;
intArr[len+1] = 0;
foo(intArr);
intArr.length = len;
//converting to float array
intArr[3] = 0.5;
foo(intArr);
//with a NaN element
intArr.push(Number.NaN);
foo(intArr);
WScript.Echo("Testing float array");
foo(floatArr);
//missing value
len = floatArr.length;
floatArr[len+1] = 0.45;
foo(floatArr);
floatArr.length = len;
floatArr.push(0.5);
foo(floatArr);
//with undefined (will convert the array)
floatArr.push(undefined);
foo(floatArr);