Home » Javascript » How about select some element in javascript? [on hold]

How about select some element in javascript? [on hold]

Posted by: admin August 19, 2018 Leave a comment

Questions:

Given an array like this:

a = [{id:1, name:'a'}, {id:2, name:'b'}, {id:3, name:'c'}, {id:4, name:'d'}, {id:5, name:'e'}];

b = ['a','d'];

c = [1,4];

How I get c from a and b? I want to get id from name. Thank u.

Answers: