admin管理员组文章数量:1297085
I a new to Angular and I just pleted a tutorial from Code School for beginners in Angular. Now in the second video the instructor of the course says that we are going to wrap our whole application code into a closure. The link to the video is below. He says this somewhere at 00:30. Now why is it a good practice to wrap our code into a closure?
Link to the video
I a new to Angular and I just pleted a tutorial from Code School for beginners in Angular. Now in the second video the instructor of the course says that we are going to wrap our whole application code into a closure. The link to the video is below. He says this somewhere at 00:30. Now why is it a good practice to wrap our code into a closure?
Link to the video
Share Improve this question asked Nov 17, 2014 at 5:26 RohanRohan 13.8k23 gold badges87 silver badges159 bronze badges1 Answer
Reset to default 15Closures are primarily used to create private scope and avoid variables from leaking into the global scope.
本文标签: javascriptIs wrapping code into a closure a good habitStack Overflow
版权声明:本文标题:javascript - Is wrapping code into a closure a good habit? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741649320a2390377.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论