I need to pick few keys and values (only name and age) from below array of objects.
const studentList = [{"id": "1", "name": "s1". "age": 10, "gender" : "m", "subject": "Maths"},{"id": "2", "name": "s2". "age": 11, "gender" : "m", "subject": "Maths"}]
I can achieve that using map and lodash pick as in below.
let nameAndAgeList = studentList.map(student => pick(student, ["name", "age"]));
But is there any more easy way with only using map. I know we can retrieve only one property as in below.
let nameArr = (studentList).map(({ name }) => name);
But how can we retrieve both name and age using map? Or any more easy & best ways with es6+