console.log('다람')
console.log('다람')
console.log('다람')
console.log('다람')
내이름 100번 출력하고 싶은데..
for (let i = 1; i<=100; i++) {
// for(초기식;조건식; 반복이 한번될때마다 연산식)
//반복 수행할 명령
console.log('다람') // 다람 백번 출력
}
const arr = ["a","b","c"];
for(let i =0; i < arr.length; i++){
console.log(arr[i]);
}
object.keys로 객체 key,value 순회let person = {
name : '다람',
age: 25,
tall: 170
};
const personKeys = object.keys(person);
//[name,age,tall]
for(let i =0; i < personKeys.length; i++){
const curKey = personKeys[i];
const curValue = person[curKey];
console.log(${curKey} : ${curValue});
}
object.values로 value 순회let person = {
name : '다람',
age: 25,
tall: 170
};
const personValues = object.values(person);
//['다람',25,170]
for(let i =0; i < personValues.length; i++){
console.log(personValues[i]);
}