ES6 for 구문을 while 처럼 조회

황제낙엽 2021.03.07 13:44 조회 수 : 559

for (let i=0; i<args.length; i++) {

  console.log(args[i]);

}

위 구문은 다음의 구문과 동일하다

 

for(const arg of args) {

  console.log(arg);

}

더 간단하게 다음과 같이 사용할 수 있다

 

args.forEach((arg) => console.log(arg));