-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
61 lines (54 loc) · 1.15 KB
/
test.js
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
// console.log(functionStatement(1,2)); //
// console.log(functionExpressions(1,2)); // ReferenceError발생
// console.log(functionArrow(1,2)); // ReferenceError발생
// 함수 선언식
function functionStatement(a,b){
let result = a + b;
return result;
}
// 함수 표현식
const functionExpressions = function(a,b) {
let result = a + b;
return result;
}
// 화살표 함수
const functionArrow = (a,b) => {
let result = a + b;
return result;
}
function namedFunction(){
console.log("나는 이름이 있어요!")
}
const obj = {
name: 'sungbird',
age: 100,
express : function expressFunc(){
console.log(this.name);
},
outerExpress : outerExpressFunc,
statement : function(){
console.log(this.name);
},
arrow: () => {
console.log(this.name);
}
}
function outerExpressFunc(){
console.log(this.name);
}
// obj.express();
// outerExpressFunc();
// const outer = obj.statement;
// obj.statement()
// outer();
obj.arrow()
// const obj2 = {
// name: 'sungbird',
// age: 100,
// express : expressFunc,
// }
// function expressFunc(){
// console.log(this.name);
// }
// const hee = obj2.express
// hee() //'sungbird'