The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Problem
Consider the cards array:
var cards = [
{ suit: "Club", rank: "A" },
{ suit: "Diamond", rank: "7" },
{ suit: "Heart", rank: "K" },
{ suit: "Heart", rank: "3" }
];
What is the value of the return value of the following function when cards is passed into the paramater hand?
var myCount = function(hand) {
var count = 0;
for (var i = 0; i < hand.length; i++) {
if (hand[i].suit == "Heart") {
count = count + 1;
}
}
return count;
};
-----------