설명

클로져, 즉시실행함수, this 예제소스들
                    
                        var b = [
                            {name:"LHJ", id:0},
                            {name:"JJJ", id:0},
                            {name:"AAA", id:0}
                        ]

                         var i;
                            var num = 100;
                            for (i=0; i<b.length; i++) {
                                b[i].id = ccc();
                            }

                        function ccc(){
                            return num+i;
                        };
                    
                
                    
                        var b = [
                            {name:"LHJ", id:0},
                            {name:"JJJ", id:0},
                            {name:"AAA", id:0}
                        ]

                        var ccc = function (){
                            return num+i;
                        };

                        var i;
                        var num = 100;
                        for (i=0; i<b.length; i++) {
                            b[i].id = ccc();
                        }
                    
                
                    
                        var b = [
                            {name:"LHJ", id:0},
                            {name:"JJJ", id:0},
                            {name:"AAA", id:0}
                        ]

                        var i;
                        var num = 100;
                        for (i=0; i<b.length; i++) {
                            b[i].id = (function (){
                                return num+i;
                            })();
                        }
                    
                
                    
                        var b = [
                            {name:"LHJ", id:0},
                            {name:"JJJ", id:0},
                            {name:"AAA", id:0}
                        ]

                        var i;
                        var num = 100;
                        for (i=0; i<b.length; i++) {
                            b[i].id = function (){
                                return num+i;
                            };
                        }
                    
                
                    
                        (function (win, $) {
                            var function1 = {
                                init: function () {
                                    this.setElements();
                                    this.bindEvents();
                                },
                                setElements: function () {
                                    this.btn = $('.btn');
                            this.btn2 = $('.btn2');
                                },
                                bindEvents: function () {
                                    this.btn.on('click', this.func1);
                                    this.btn2.on('click', $.proxy(this.func2, this));
                                },
                                func1: function () {

                                },
                                func2: function () {

                                },
                            };
                            function1.init();
                        })(window, window.jQuery);