var users = [ { name: ‘Jack‘, age: 21 }, { name: ‘Ben‘, age: 23 }, { name: ‘Adam‘, age: 22 }, ]; console.log( users.map(function(user) { return user.age; }) ); // [21, 23, 22] var users = [ { name: ‘Jack‘, age: 21 }, { name: ‘Ben‘, age: 23 }, { name: ‘Adam‘, age: 22 }, ]; console.log(users.map(user => user.age)); // [21, 23, 22]
原文:https://www.cnblogs.com/Longhua-0/p/9189243.html