Please consider the following snippet of code:
> a = [1, undefined, undefined, undefined, 3] [1, undefined, undefined, undefined, 3] > b = [1,,,,3]
//-1 means not in the list //['a','b','c'].indexOf('a') is return index if not find in the list then it give -1. if(['a','b','c'].indexOf('d') == -1) { console.log('yes it -1') }