//sample solution
// Define a function called deal
// It should return a random number between 1 and 52
var deal = function(){
var card = Math.floor(Math.random()*52 + 1);
return card;
};
// Declare two variables
// For both variables, assign values gotten by calling the function
var card1 = deal();
var card2 = deal();
//test
console.log("Value of card1 is "+card1);
console.log("Value of card2 is "+card2);
//special case: What if card1 has the same value as card2?
No comments:
Post a Comment