Created
September 7, 2015 15:19
-
-
Save kulakowka/1554594a475eef2d79f4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var basketModule = (function() { | |
var basket = []; // приватная переменная | |
return { // методы доступные извне | |
addItem: function(values) { | |
basket.push(values); | |
}, | |
getItemCount: function() { | |
return basket.length; | |
}, | |
getTotal: function() { | |
var q = this.getItemCount(),p=0; | |
while(q--){ | |
p+= basket[q].price; | |
} | |
return p; | |
} | |
} | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment