I am trying to output the first two objects in the events array using indexOf.
This doesn\'t return anything:
var whiteList=[\'css\',\'js\'];
var
With ES6, you could use Set for faster access with larger data sets.
var whiteList = ['css', 'js'],
whiteSet = new Set(whiteList),
events = [{ file: 'css/style.css', type: 'css' }, { file: 'js/app.js', type: 'js' }, { file: 'index/html.html', type: 'html' }],
fileList = events.filter(event => whiteSet.has(event.type));
console.log(fileList);