function Player () { this.collection = []; // Cards this.decks = [ // { // name: 'Deck Name', // cards: [], // Card ids // } ]; } Player.prototype.checkCurrency = function (type) { if (typeof type !== 'undefined') { for (var i = 0; i < this.collection.length; i++) { } } }