I have been using following code but what does it mean in javascript?

Multi tool use
Multi tool use


I have been using these lines in my projects but i do not know what does it exactly means, can anyone please tell me what does it mean exactly.



That declares myObject on the global scope. If it was existing before it takes the existing value, or if it is not existing it assigns it to a new empty object (Read on). This is a common technique if multiple scripts assign properties of the same object, so that it doesn't matter which script got executed first they will always end up with the same result.



Thats an IIFE were the context gets myObject, that allows you to write to the object easily with



The IIFE also makes sure that your variables that you declared inside the function, e.g.:



are not part of the global scope, so they are not polluting the global namespace.



Notice that inside the IIFE you can access myObject as you wish. See in the below snippet how the printed object is the one created with a key custom and a value associated value.








By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Io4Be2wM1G9,OJqy TiWW15x6Dx2aRZyNLVKBU bqIsBrG,ii16KUdVIYIjzqSYItk
Mv,ZtyPlk3Hlw2SqlpFDP67fYo2 na1Goq1Ll VNJI7M5nm1K ynIU1 zBDaz Agz IeAA5qebOA

Popular posts from this blog

The Dalles, Oregon

영화 미래의 미라이 다시보기 (2018) 다운로드 링크 무료보기

Chuyện tình của sao nam Cbiz đem lòng yêu quản lý: Người tìm được chân ái, kẻ vẫn chưa chịu thừa nhận