Índice Bitwise de abreviação em JavaScript

// Bitwise IndexOf Shorthand in javascript
// Longhand:
if(arr.indexOf(item) > -1) { 
  // Confirm item IS found
}

if(arr.indexOf(item) === -1) { 
  // Confirm item IS NOT found
}

// Shorthand:
if(~arr.indexOf(item)) { 
  // Confirm item IS found
}

if(!~arr.indexOf(item)) { 
  // Confirm item IS NOT found
}

// we can also use the includes() function:
if(arr.includes(item)) { 
  // Returns true if the item exists, false if it doesn't
}
Chetan Nada