I have the following code and I want to make the deck array full of 52 different cards. Whenever I run the code and the card object is alerted it displays as '[object Object]'.
Can someone explain to me why it does this and a solution for this problem?
var suits = ["Clubs", "Diamonds", "Hearts", "Spades"];
var ranks = ["A", 2, 3, 4, 5, 6, 7, 8, 9, 10, "J", "Q", "K"];
var deck = [];
for (var i = 0; i < suits.length; i++) {
for (var j = 0; j < ranks.length; j++) {
var card = {rank: ranks[j], suit: suits[i]};
deck.push(card);
alert(card)
}
}