<script>
var users = [
{name:'name1',age:21},
{name:'name2',age:22},
{name:'name3',age:23}
]; users.forEach(function(e){
console.log('name:'+e.name+',age:'+e.age);
}); </script>
运行结果:
name:name1,age:21
name:name2,age:22
name:name3,age:23
<script>
var users = [
{name:'name1',age:21},
{name:'name2',age:22},
{name:'name3',age:23}
]; users.forEach(function(e){
console.log('name:'+e.name+',age:'+e.age);
}); </script>
运行结果:
name:name1,age:21
name:name2,age:22
name:name3,age:23