1const currentData = ['a', undefined], index = 1;
2
3if (index in currentData) {
4 console.info('exists');
5}
6// ...vs...
7if (typeof currentData[index] !== 'undefined') {
8 console.info('exists');
9} else {
10 console.info('does not exist'); // incorrect!
11}