when looking at the minified Sizzle code, I noticed that it begins like this:
!function(a){//...
}(window)
Why is there an exclamation point at the beginning?
I thought that !
was the not
operator.
Thank you.
Edit:
Full Code.
To check if an array contains duplicates: Use the Array. some() method to iterate over the array. Check if the index of the first occurrence of the current value is NOT equal to the index of its last occurrence. If the condition is met, then the array contains duplicates.
function checkIfArrayIsUnique(myArray) { for (var i = 0; i < myArray. length; i++) { for (var j = 0; j < myArray. length; j++) { if (i != j) { if (myArray[i] == myArray[j]) { return true; // means there are duplicate values } } } } return false; // means there are no duplicate values. }
!function(a){/* ... */}();
Using an unary operator to invoke an IIFE is common practice. That's a common shorthand for:
(function(a){/* ... */}());
or:
(function(a){/* ... */})();
You can also substitute the not unary operator with any other unary operator:
-function(a){ /* ... */ }();
+function(a){ /* ... */ }();
/* ... etc. */
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With