I have seen multiple codes where index of arrays are compared to -1, like
if (index === -1) What does this exactly do?
I believe we can't store values in negative index, at least as array element. (I know, As a property of array, we can indeed do that). But then when will the above condition return true or false?
if ( ~str.indexOf(...) ) { console.log('Found!') }.