What does this mean?
!function a(){
}({
x: [function(){alert(2);}]
})
When I reading some codes in a chrome extension, I have found this block of code. I am confused how this should work.
What does this mean?
!function a(){
}({
x: [function(){alert(2);}]
})
When I reading some codes in a chrome extension, I have found this block of code. I am confused how this should work.
It's just another way of writing an IIFE, using a !
operator instead of parentheses. There are a variety of operators that can be used this way:
! function(text) {
console.log(text);
}('hello');