How can I filter a dataset using another array of elements?
var filterBy = ["apple", "orange", "grapes"];
var selectColsIdx = [0, 1]
var data = [[1, "orange", 20], [3, "grapes", 4], [6, "bananas", 9]];
I am looking to apply the filterBy
array as a filter to the subarrays in the data
dataset (specifically index 1), and return only items indexed 0 and 1 as shown below:
res = [[1, "orange"], [3, "grapes"]]