pav
6/4/2013 - 7:54 PM

Here's the pseudo code for the answer -Loop from 0 to suits.length -Loop from 0 to ranks.length -Create an array that stores the current su

Here's the pseudo code for the answer -Loop from 0 to suits.length -Loop from 0 to ranks.length -Create an array that stores the current suit and rank and add it to the end of the deck array: deck.push(cardArray)

//array 1: the suits
var suits = ["clubs","hearts","diamonds","spades"];

//array 2: the ranks
var ranks = [2,3,4,5,6,7,8,9,10,"J","Q","K","A"];

//using for loops, modify the "deck" array so that it becomes a 
//two-dimensional array that stores every card in the deck; 
//e.g. [1, "clubs"], [2, "clubs"],etc...["A", "spades"]
var deck = [];
for (var i = 1; i <= suits.length; i++) {
for (var j=1; j<=ranks.length; j++) {
deck.push([ranks[j-1],suits[i-1]]) ;

console.log (deck);

}

}