As you can see above, arrayIndexOf refers to a function. When invoking the arrayIndexOf function, is it necessary to put "~" before "arrayIndexOf"? I try to change "~arrayIndexOf(value, field)" to "arrayIndexOf(value, field)". And it works as the same? Is there anything I miss?
            Asked
            
        
        
            Active
            
        
            Viewed 42 times
        
    1 Answers
0
            In JavaScript, the tilde ~ Bitwise NOT operator is commonly used right before an indexOf() to do a boolean check (truthy/falsy) on a string. On its own, indexOf() returns the index number of a String object passed in. So if -1 is returned it will be turned into 0 which is falsy.
 
    
    
        user9385381
        
- 252
- 3
- 10
