If I want to get the second element of an array, I simply index it with 1:
const arr = [2, 3, 5, 7, 11]
console.log(arr[1])
Outputs 3
Is there a way to index multiple elements of an array with an array of indices? Something like this (which doesn't work):
const arr = [2, 3, 5, 7, 11]
const indices = [1, 2, 4]
console.log(arr[indices])
Should output [3, 5, 11]
But actually outputs undefined