📜  javascript for each - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:06.890000             🧑  作者: Mango

代码示例6
const emperors = [{
   name: 'D. Luffy',
   age: 10
},{
   name: 'Jhey',
   age: 30
}];

emperors.forEach(emperor => console.log(`${emperor.name} is ${emperor.age} years old `));