Notice
Recent Posts
Recent Comments
Link
목록method shorthand (1)
함께 성장하는 프로독학러
9. 메서드를 선언할 때 function을 생략, method shorthand
안녕하세요, 프로독학러 입니다. 이번 포스팅에서는 ES6의 method shorthand에 대해서 알아보겠습니다. 표현식부터 살펴보도록 하겠습니다. // 단축 메서드명 (ES6) var o = { property([parameters]) {}, get property() {}, set property(value) {}, * generator() {} };위와 같이 객체 안에서 메서드를 지정할 때 function을 생략할 수 있습니다. 이해를 돕기위해 예제를 살펴보겠습니다. 1234567891011var obj = { add: function (a, b){ return a+b; }, mult: function (a, b){ return a*b; }} console.log(obj.add(10, 5)); //..
Programming/ES6
2018. 4. 11. 22:33