Yes you could. But anytime you call .shuffle()
you would overwrite that array, or more precisely, create a new instance. So if you want to keep that reference you could go like
var shuffle = (function() {
var deck = [];
return function(x) {
deck.push(x);
return deck;
};
}());
Now .shuffle()
closes over the deck
by returning another function. So it could look like
var Placemat = function() {
var myDeck = shuffle(5);
shuffle(10);
shuffle(15);
var card1 = deck.shift();
var card2 = deck.shift();
}
Even if that is probably not the greatest way to go. But I guess I don't even know what exactly you want to achieve there.