For the case of using this with assumptions:
array.length >== 1
(i.e. an array with significant data in it already)
If you are interested in data from array[1], array[15], array[45]etc.
You can do something similar to:
var array = ["you","will","become","strong","with","the","codes","padawan"];
var values = [1,5,7];
for (var i = 0; i < values.length; i++){
var cypher = values[i];
console.log(array[cypher]);
}
Or perhaps something more meaningful, for example:
for (var i = 0; i < values.length; i++){
var cypher = values[i];
aService.aFn.(array[cypher],cb);
}
source
share