What does ~[Array].indexOf(key) do?
This question already has an answer here:
indexOf
returns -1
if not found. ~-1
is 0
, ie false
. So the whole things means: if key
is found in the array, do continue.
This question already has an answer here:
indexOf
returns -1
if not found. ~-1
is 0
, ie false
. So the whole things means: if key
is found in the array, do continue.