一、今日学习内容
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
// let nam = [];
// let cat ={
// type:'英短',
// name:'boom',
// sex:'母',
// age:2,
// hobby:['睡觉','吃饭','打豆豆']
// }
// for (let key in cat){
// if (key=='hobby'){
// cat[key].forEach(function(a){
// nam.push(a);});
// }else{
// nam.push(cat[key]);
// }
// }
// console.log(nam);
let arr=[1,3,2,5];
let sum =1;
if(key=arr){
arr.forEach(function(a) {
sum*=a;
return sum;
});
}
console.log(sum);
</script>
</body>
</html>
|