3

I can read and write some JavaScript, but today I came across a .js file starting with

!function() {
 /*
  code here
 */
}.call(window);

Question

what does ! infront of function means?

daydreamer
  • 80,741
  • 175
  • 429
  • 691

2 Answers2

2

It returns "not" (!) of the result of a calling the anonymous function with a "this" of window.

Peter Alfvin
  • 27,785
  • 8
  • 64
  • 103
1

Negating the result of .call(window). Not the function.

djechlin
  • 57,408
  • 33
  • 153
  • 271