Quotes help make search much faster. Example: "Practice Makes Perfect"

Wednesday, December 5, 2012

Codecademy: Codeyear What's the Score?


//sample solution


// Our deal function will return one random card
var deal = function(){
var card = Math.floor(Math.random()*52 + 1);
return card;
};
// Declare our two variables card1 and card2
var card1 = deal();
var card2 = deal();
// Define a function called score, which will assign points by
// adding up the cards:
var score = function(){
return card1 + card2;
};

console.log("You have cards " + card1 + " and " + card2 +
        " for a score of " + score());

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts