forked from lfkdsk/PracticeCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfuncTest.js
More file actions
64 lines (42 loc) · 865 Bytes
/
Copy pathfuncTest.js
File metadata and controls
64 lines (42 loc) · 865 Bytes
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
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* Created by liufengkai on 16/6/25.
*/
function absTest(x) {
if (typeof x !== 'number') {
throw 'Not a number';
}
if (x >= 0) {
return x;
} else {
return -x;
}
}
var x = 10;
x = absTest(x);
console.log(x);
// absTest('flss');
function foo(x) {
console.log('x -> ' + x);
for (var i = 0; i < arguments.length; i++) {
console.log(arguments[i]);
}
}
foo(100, 'dddd', 'opopop', true);
// function lfkdskll(aa, bb, ...rest) {
// console.log(rest);
// }
// lfkdskll(11, 22, 22222, 'fffff');
// function lfkdskll() {
// for (let i = 0; i < 1000; i++) {
// console.log(i);
// }
// }
// lfkdskll();
var myself = {
birth: 1996,
age: function () {
var y = new Date().getFullYear();
return y - this.birth;
}
};
console.log(myself.age());