Yesterday I work a lot with JavaScript and here is beautiful JS example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | var Example = window.Example || (function() { var self = {}; // This method: self.Update = function() { var self = {}; self.itemcurrency = function() { } self.currency = function() { } return self; }, // Or this method: self.Update2 = { ItemCurrency: function() { }, Currency: function() { } } return self; })(); |
Usage:
1 2 3 4 | // For first method Example.Update().itemcurrency(); // For second method Example.Update2.itemcurrency(); |
Hope this helps you to create nice JavaScript code!