for ... of
문자열 그대로 쓸 수 있음.
const str = 'banana'; for (const c of str) { console.log(c) }
forEach
배열로 변환 후 배열 함수인 forEach 사용
자스는 무조건 2bytes라고 생각하면 됨. 따라서 [...문자열] 한 후 공백을 없애주고 써야 제대로 동작.
const str = 'banana'; [...str].forEach(char=>console.log(char));