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
You are doing it wrong, it should go like this.
var whiteList = ['css', 'js'];
var events = [{
file: 'css/style.css',
type: 'css'
}, {
file: 'js/app.js',
type: 'js'
}, {
file: 'index/html.html',
type: 'html'
}];
var fileList = events.filter(function(event) {
return whiteList.indexOf(event.type) > -1
})
console.log(fileList)