5

I found some places people are writing JavaScript with starting function (undefined).Can I know why they are writing like this what is the advantage and disadvantage of using like this

(function(undefined) {
    /* some logic functions etc..*/
})();
Tushar
  • 85,780
  • 21
  • 159
  • 179
Prithivi Thiyagu
  • 129
  • 1
  • 11
  • Although the linked answers explains why, though I think there's no advantage to this approach. As per ECMAScript 5, undefined is not writable,configurable so its not an issue anymore in modern browsers even if its not strict.. – Anirudha Jul 25 '16 at 10:59

0 Answers0