티스토리 뷰

728x90
반응형


ES6에서 지원하는 스프레드 연산자 ..


//
var a, b, c, d, e;
a = [1,2,3];
b = "dog";
c = [42, "cat"];

// Using the concat method.
d = a.concat(b, c);

// Using the spread operator.
e = [...a, b, ...c];

console.log(d);
console.log(e);

// Output:
// 1, 2, 3, "dog", 42, "cat"
// 1, 2, 3, "dog", 42, "cat"
//


참고 - MS - https://msdn.microsoft.com/ko-kr/library/dn919259(v=vs.94).aspx

          MDN - https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Operators/Spread_operator

728x90
반응형

'Programming language > javascript' 카테고리의 다른 글

karma 설정  (0) 2017.05.31
Nodejs 한글 및 Express.js 안내~  (0) 2017.02.17
Template literal(템플릿 리터럴)  (0) 2016.09.08
ES6 import 구문  (0) 2016.08.19
ES6 Arrow Function 참고  (0) 2016.08.18
댓글