<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script>
const names = ['zhang','li','deng','mongodb'];
// for(let i = 0;i < names.length;i++){
// console.log(names[i]);
// }
// names.forEach(name => {
// console.log(name)
// })//不可以终止这个循环
// for (let index in names) {//遍历对象中的可枚举的属性
// console.log(names[index])
// }
for(let name of names){//他循环的事数组对象的属性,可以终止循环
console.log(name);
}
</script>
</body>
</html>