0

I came a cross JavaScript file on github
https://github.com/bruno222/whatsapp-web-bot/blob/master/bot.js
the script has certain usage on certain web page. The instructions to use the script is to copy the file content and paste it in the console in developer tools of the browser.

I couldn't understand why the script start with (() => { JavaScript content and then it ends with })() .

What does (() => { ...JavaScript Code... })() mean? And is there a reference for such implementation (adding block of code in the console)?

Thanks in advance.

lotav
  • 327
  • 4
  • 10
  • 1
    This is an immediately invoked function, the `()` is just a way of invoking the function as soon as it is read. – Michael May 03 '20 at 16:50
  • Thanks. It get so much easier to understand when you have a name to look for "IIFE". – lotav May 03 '20 at 17:44

0 Answers0