0
what's meaning the symbol "!" before a function ? return something different ?
one exemple : var a=5; !function (x) {a=x;}(7) alert(a);
3 ответов
+ 2
! is the boolean not operator, which you probably know. Calling a function results in a value (in this case undefined). The side effect still happens, so a will be assigned 7, but then nothing happens. You can rewrite it like this:
a = x;
!undefined
!undefined is true, but since it isn't used at all, it won't matter.