**2.**通过使用map方法返回一个数组,获得对象数组中某些特定属性值
var students = [
{name: “a”, “age”: “23”, “sex”: “男”},
{name: “b”, “age”: “24”, “sex”: “女”},
{name: “c”, “age”: “25”, “sex”: “男”}
];
// 获取students中的age
var ages = [];
students.map( (student)=> {
ages.push(students.age);
});
console.log(“—”, ages); //返回结果:[“23”, “24”, “25”]
**3.**通过使用map方法返回一个数组,返回由原来数组中的每个元素的平方组成的新数组
var array = [2, 3, 4, 5, 6, 7, 8, 9];
var newArr = array.map((item) => {
return item * item; //求平方
});
console.log(“——===”,newArr) //返回结果: [ 4, 9, 16, 25, 36, 49, 64, 81]
**4.**通过使用map方法返回一个数组,处理想要的数据
list.map((item) => {
const { userName, workId, deptName } = item;
result.push({
name,
label: ${userName}${workId} ${deptName}<