* Case 1
(function(window, $) {
var someVar = true;
var test = {
some: 'test',
setValue: function() {
// some code
}
};
window.test = test;
})(window, jQuery);
* Case 2
var test = (function(test, $, undefined) {
var someVar = true;
test.some = 'test';
test.setValue = function() {
// some code
}
return test;
}(window.test || {}, jQuery));
'Development > JavaScript' 카테고리의 다른 글
javascript - How to merge two arrays in Javascript and de-duplicate items (0) | 2015.08.30 |
---|---|
javascript - Window self Property (0) | 2015.07.11 |
javaScript - Data Types (0) | 2015.07.11 |
javascript - How does this JavaScript/JQuery Syntax work: (function( window, undefined ) { })(window)? (0) | 2015.07.11 |
javascript - objects (0) | 2015.07.11 |