loading...

Discussion on: The Empty Statement in JavaScript

Collapse
aakatev profile image
Artem

Actually empty statements in js can have some legitimate use cases. For example, to prevent undesired behavior in IIFE you sometime want to prefix it with empty statement, like so:

;(()=>console.log('ooof'))()
Collapse
bhagatparwinder profile image
Parwinder πŸ‘¨πŸ»β€πŸ’» Author

Ah thanks! Figured out when and what sort of undesirable behavior. If we are concatenating two JS files it could definitely cause issues. Here’s a write up with an example:

mariusschulz.com/articles/disassem...

Collapse
aakatev profile image
Artem

Sure, and my bad, I should have specified it in the original post!