title: How to randomly select a card from a deck of cards and not select it again?
body: <p>I am trying to build a game based on random card selection. The player draws a card, once the card has been drawn the card will not be drawn again. </p>
  
  <p>I've tried to make it work but I'm getting an error on my website saying "Uncaught TypeError: currentCard.filter is not a function"</p>
  
  <p>Here is my code:</p>
  
  <pre><code>    cards = [
      'clubs-ace',
      'clubs-2',
      'clubs-3',
      'clubs-4',
      'clubs-5',
      'clubs-6',
      'clubs-7',
      'clubs-8',
      'clubs-9',
      'clubs-10',
      'clubs-jack',
      'clubs-queen',
      'clubs-king',
      'diamonds-ace',
      'diamonds-2',
      'diamonds-3',
      'diamonds-4',
      'diamonds-5',
      'diamonds-6',
      'diamonds-7',
      'diamonds-8',
      'diamonds-9',
      'diamonds-10',
      'diamonds-jack',
      'diamonds-queen',
      'diamonds-king',
      'hearts-ace',
      'hearts-2',
      'hearts-3',
      'hearts-4',
      'hearts-5',
      'hearts-6',
      'hearts-7',
      'hearts-8',
      'hearts-9',
      'hearts-10',
      'hearts-jack',
      'hearts-queen',
      'hearts-king',
      'spades-ace',
      'spades-2',
      'spades-3',
      'spades-4',
      'spades-5',
      'spades-6',
      'spades-7',
      'spades-8',
      'spades-9',
      'spades-10',
      'spades-jack',
      'spades-queen',
      'spades-king'
  ];
  
  var currentCard = "";
  var kingsCup = 0;
  
  function drawCard() {
      var randomNumber = Math.floor(Math.random() * (currentCard.length));
      currentCard = currentCard.filter((e, i) =&gt; i !== randomNumber);
      console.log(currentCard.length);
  
      switch(currentCard[randomNumber]) {
          case 1:
             document.getElementById("cards").src="assets/js/games/cards/clubs-ace.png";
          break;
          case 2:
              document.getElementById("cards").src="assets/js/games/cards/clubs-2.png";
          break;
          case 3:
              document.getElementById("cards").src="assets/js/games/cards/clubs-3.png";
          break;
          case 4:
              document.getElementById("cards").src="assets/js/games/cards/clubs-4.png";
          break;
          case 5:
              document.getElementById("cards").src="assets/js/games/cards/clubs-5.png";
          break;
          case 6:
              document.getElementById("cards").src="assets/js/games/cards/clubs-6.png";
          break;
          case 7:
              document.getElementById("cards").src="assets/js/games/cards/clubs-7.png";
          break;
          case 8:
              document.getElementById("cards").src="assets/js/games/cards/clubs-8.png";
          break;
          case 9:
              document.getElementById("cards").src="assets/js/games/cards/clubs-9.png";
          break;
      }
  }
  </code></pre>
  
  <p>I'm a beginner at JS and the code could probably be written in a neater and more efficient way, so please excuse the long, messy code.</p>
  
  <p>What am I doing wrong?</p>