emenencio1 / exercise-random-card

💻📹Video Tutorial: Ideal project tutorial for Javascript newbies, build a random card dealer with little JS, HTML and CSS.

Home Page:https://projects.breatheco.de/interactive-coding-tutorial/beginner/random-card

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

alt text Random Card Dealer in Javascript, HTML and CSS

In this project you will learn how to change your website styles during the runtime using VanillaJS (plain normal js).

📝 Instructions

Create an algorithm that randomly builds a card on every refresh:

  1. Every time the website refreshes a new random card needs to show.
  2. The card must have one of the possible suites: Hearts, Spades, Clubs and Diamonds.
  3. The card value must be one of the following: 1 to 10, King, Queen, Jack or Ace (no joker).

In the end, the project needs to look similar to this demo.

💡Hints

  • Remember that the first event on a website lifecycle is onLoad (your code starts running there), you should generate a random number between 1 and 4 to pick a sute and another random number between 0 and 12 to pick a card number.
  • Create a general .card class that applies the general styles to each card, and one additional CSS class for each suite: .spade, .club, .heart & .diamond.
  • Apply the .card class to the entire div but only apply one of the suite classes at a time depending on what suite you want to apply. For example a 3 of hearts will have this HTML declaration:
    <div class='card heart'></div>

https://ucarecdn.com/7cd14b33-dd69-4680-aaf3-ab16afe2316b/ScreenShot20190511at30921AM.png

About

💻📹Video Tutorial: Ideal project tutorial for Javascript newbies, build a random card dealer with little JS, HTML and CSS.

https://projects.breatheco.de/interactive-coding-tutorial/beginner/random-card

License:Other


Languages

Language:HTML 56.8%Language:JavaScript 26.7%Language:CSS 16.4%