I am fairly new to javascript and had some trouble making a program. I want the program to ask the user how many cards they want to draw from a deck, but I need help getting my program to type how many cards of each suite were picked in the end.
var NUM =  readInt("How many cards will you draw from the deck?");
var RANDOM = Randomizer.nextBoolean();
var DIAMONDS = "Diamonds";
var HEARTS = "Hearts";
var SPADES = "Spades";
var CLUBS = "Clubs";
function start(){
    var take = takeCard();
    printArray(take);
    countCards(take);
}
// This function will pick a random card from the deck.
//Needs Work
function takeCard(){
    var pick = [];
    for(var i = 0; i < NUM; i++){
    if(Randomizer.nextBoolean()){
        pick.push(DIAMONDS);
        }else{
            pick.push(HEARTS);
            pick.push(SPADES);
            pick.push(CLUBS);
        }
    }
    return pick;
}
// Displays the array
function printArray(arr){
    for(var i = 0; i < arr.length; i++){
        println("Flip Number " + (i+1) + ": " + arr[i]);
    }
}
//Counts the number of Cards in each suite
//Needs Work
function countCards(take){
    var countOne = 0;
    var countTwo = 0;
    var countThree = 0;
    var countFour = 0;
    for(var i = 0; i < take.length; i++){
        if(take[i] == "Heads"){
        countOne++;
    } else {
        countTwo++;
    }
    }
    println("Number of Diamonds: " + countOne);
    println("Number of Hearts: " + countTwo);
    println("Number of Spades: " + countThree);
    println("Number of Clubs: " + countFour);
} 
    