Give Me a Hand explainer

Aim of the puzzle: Use .shift() to remove the 1st item of an array.
Walk through of solution: The .shift() array method is similar to .pop(), except it removes and returns the 1st element of an array rather than the last.

In this puzzle, a shuffled deck of cards is imported to the puzzle as the array deck. The drawCard() function takes the parameter cards and returns cards.shift(). When this function is called with deck as an argument, it will return the 1st element of deck.

To complete the puzzle, add return cards.shift() inside the drawCard() function body.
Sample code solution:

import { deck } from 'grasshopper.croupier';

function drawCard(cards) {
    return cards.shift();
}

console.log(deck.length);
console.log('Your card is: ' + drawCard(deck));
console.log(deck.length);

Additional Code
There is additional code that runs when the puzzle loads. This code creates a deck of cards and shuffles it using a JavaScript implementation of the Fisher-Yates Shuffle Algorithm.

const _deck = (()=> {
    const cards = [];
    const suits = ['Hearts', 'Spades', 'Clubs', 'Diamonds'];
    const values = ['Ace', 2, 3, 4, 5, 6, 7, 8, 9, 10, 'Jack', 'Queen', 'King'];
    
    for (let suit in suits) {
      for (let value in values) {
        cards.push(`${values[value]} of ${suits[suit]}`);
      }
    }
    return cards;
})();

const shuffle = (array) => {
    for (let i = array.length - 1; i > 0; i--) {
        let j = Math.floor(Math.random() * (i + 1));
        [array[i], array[j]] = [array[j], array[i]];
    }
    return array;
};

defineModule(
    'grasshopper.croupier',
    {
        deck: shuffle(_deck),
        
    }
);

Javascript Concepts: Arrays, .shift(), Array Methods, Import Declarations, Function Declarations, console.log()