-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path9.1_function_constructor.html
More file actions
42 lines (38 loc) · 1.06 KB
/
Copy path9.1_function_constructor.html
File metadata and controls
42 lines (38 loc) · 1.06 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>function constructor</title>
<link rel="stylesheet" href="qunit/qunit-1.18.0.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="qunit/qunit-1.18.0.js"></script>
<script type="text/javascript">
QUnit.test("function constructor", function(assert)
{
var c = 100;
(function()
{
var c = 100;
var add1 = new Function("a", "b",
"return a + b + c ");
var add2 = new Function("a", "b", "return a + b ");
assert.deepEqual(add1(1, 2), 103);
assert.deepEqual(add2(1, 2), 3);
}());
var add1 = function(a, b)
{
return a + b + c
}
var add2 = function(a, b)
{
return a + b
}
assert.deepEqual(add1(1, 2), 103);
assert.deepEqual(add2(1, 2), 3);
});
</script>
</body>
</html>