Notice
Recent Posts
Recent Comments
Link
목록HTML,CSS,JavaScript (7)
개발일지
Enhanced Object Literals
- 객체의 속성을 메서드로 사용할 때 function 예약어를 생략하고 생성 가능 var dic = { words: 100, // ES5 func: function(){ console.log("find"); }, // ES6 func() { console.log("find"); } }; - 객체의 속성명과 값 명이 동일할 때 아래와 같이 축약 가능 let figs = 10; let dic = { // figs : figs figs };
HTML,CSS,JavaScript
2019. 10. 27. 20:59
Arrow Function
- 함수를 정의할 때 function 이라는 키워드를 사용하지 않고 => 로 대체 - 흔히 사용하는 콜백 함수의 문법을 간결화 // ES5 var arr = ["1", "2", "3"]; arr.forEach(function(value) { console.log(value);// 1, 2, 3 }); // ES6 let arr = ["1", "2", "3"]; arr.forEach(value => console.log(value)); // 1, 2, 3
HTML,CSS,JavaScript
2019. 10. 27. 20:50