JSFiddle - React, Tailwind, and code Playground

by frogggeee McFrogggeee

HTML

<!DOCTYPE html>
<html>
<head>
<body>
<h1>Blackjack</h1>
<p>by frogggeee</p>
<canvas id = "canvas" width = "480" height = "360" ></canvas>
<script>
let canvas = document.getElementById("canvas");
let ctx = canvas.getContext("2d");
let cardSpriteSheet = new Image();
let cardNum = [1, 2, 3, 4, 5, 6, 7, 8, 9, "t", "j", "q", "k"];
let cardLogo = [0, 1, 2, 3];
let usedCards = [];
let playerCards = [];
let player2Cards = [];
let cn = 0;
let cl = 0;
cardSpriteSheet.src = "http://einaregilsson.github.io/cards.js/img/cards.png";
function setCards() { /* deals cards */
	usedCards = [];
  cn = cardNum[Math.floor(Math.random() * 13)];
  cl = Math.floor(Math.random() * 3);
  for (let i = 0; i < 2; i++) {
     while (usedCards.includes(cn + "" + cl) == true) {
       cn = cardNum[Math.floor(Math.random() * 13)];
       cl = Math.floor(Math.random() * 3);
     }
     usedCards.push(cn + "" + cl);
     playerCards.push(cn + "" + cl);
     while (usedCards.includes(cn + "" + cl) == true) {
       cn = cardNum[Math.floor(Math.random() * 13)];
       cl = Math.floor(Math.random() * 3);
     }
     usedCards.push(cn + "" + cl);
     player2Cards.push(cn + "" + cl);
  }
}
function say(thing) { /* asks the player if they want to hit or stand */
	switch(thing) {
  	case 1: 
    case 2:
  }
}
function giveCard(player) {
	if (player == 1) {
  	cn = cardNum[Math.floor(Math.random() * 13)];
  cl = Math.floor(Math.random() * 3);
     while (usedCards.includes(cn + "" + cl) == true) {
       cn = cardNum[Math.floor(Math.random() * 13)];
       cl = Math.floor(Math.random() * 3);
     }
     usedCards.push(cn + "" + cl);
     playerCards.push(cn + "" + cl);
  } else if (player == 2) {
  	cn = cardNum[Math.floor(Math.random() * 13)];
  cl = Math.floor(Math.random() * 3);
     while (usedCards.includes(cn + "" + cl) == true) {
       cn = cardNum[Math.floor(Math.random() * 13)];
       cl = Math.floor(Math.random() * 3);
     }
     usedCards.push(cn + "" + cl);
     player2Cards.push(cn + "" +...