// * 循环
const arr = [1 , 2 , 1 ]
let s = 0
while ( s < arr.length) {
console.log(arr[s])
s++
}
console.log('-----------');
s = 0
do {
console.log(arr[s])
s++
}
while ( s < arr.length)
console.log('-----------');
for (let s = 0 ; s < arr.length ; s++){
console.log(arr[s]);
}
// * for-of 循环
console.log('-----------');
for (let item of arr){
console.log(item);
}
console.log('-----------');
arr.forEach(item => {
console.log(item);
});
console.log('-----------');
// * for-in
const user = {
id : 123 ,
name : 564 ,
}
for (let item in user)
{
console.log(user[item]);
}
console.log('-----------');