How to extract the data needed in array B according to the integer array A?

for example. Integer array A:

[0,2,3]

Array B:

[
  {id:22, name:"aaa"},
  {id:1, name:"sss"},
  {id:2, name:"qq"},
  {id:5, name:"sdd"},
  ...
]

according to array A, the required data is id of [0], [2], [3] bits of array B. It"s [22pr 2pr 5] like this. Could you tell me how to extract it?

Mar.17,2021

let indexs = [0, 2, 3]
let data = [{...}, {...}]
let result = indexs.map(i => data[i].id)
Menu