[컴][nodejs] 내가 자주사용하는 ES 6 문법

ECMA1025, ES2015, ES6 ECMA6 syntax


let
const 한 variable 을 지정할 때 사용
let a = 1, b=2


Template literals
var a = 5;
var b = 10;
console.log(`Fifteen is ${a + b} and\nnot ${2 * a + b}.`);



for...of

let iterable = [10, 20, 30];
for (let value of iterable) {
  console.log(value);
}




class 
class Polygon {
  constructor(height, width) {
    this.name = 'Polygon';
    this.height = height;
    this.width = width;
  }
}



댓글 없음:

댓글 쓰기