Question

javascript questions

  1. Declare an empty deck array. Use a loop to fill the array with string values that represent the 52 cards of a normal deck. The numbers go from 1 to 13 with 1 for an ace, 11 for a jack, 12 for a queen, and 13 for a king. The suits are C for clubs, D for diamonds, H for hearts, and S for spades. Here’s the list of 52 values:
    1C, …, 13C, 1D, …, 13D, 1H, …, 13H, 1S, …, 13S
    To test your answer, you can stick your code in a script container with this line at the bottom:

    console.log("deck = " + deck);
  2. The following code implements a simple web page that creates a list of cheerleader names and sorts the names. Provide an improved version of the web page that stores each cheerleader’s height in centimeters and sorts the cheerleaders by height. Among other things, you’ll need to implement a Cheerleader class with name and height properties.

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <meta name="author" content="John Dean">
    <title>Stunt Group</title>
    <script>
      var stuntGroup = new Array();
    
      function addCheerleader() {
        stuntGroup.push(document.getElementById("cheerleader").value);
        stuntGroup.sort();
      } // end addCheerleader
    
      function displayStuntGroup() {
        var namesColumn = "";
    
        for (let i=0; i<stuntGroup.length; i++) {
          namesColumn += stuntGroup[i] + "<br>";
        }
        document.getElementById("stunt-group").innerHTML = namesColumn;
      } // end displayStuntGroup
    </script>
    </head>
    
    
    <body>
    <input type="text" id="cheerleader">
    <br>
    <input type="button" value="Add cheerleader"
      onclick="addCheerleader();">
    <br><br>
    <input type="button" value="Display stunt group"
      onclick="displayStuntGroup();">
    <div id="stunt-group"></div>
    </body>
    </html>
  3. Describe what happens to the bookMtgList array if the following code executes. In your answer, you must mention the 0 return value.

    bookMtgList.sort(function (a, b) {return 0;});
  4. Improve the Book Club web page presented earlier by adding a delete button for each book meeting. When the user clicks a book meeting’s delete button, the book meeting should be removed from the bookMtgList array, and it should disappear from the displayed schedule.

    D Book Club Book CluB ORGANIZER High culture andpretentious literature at tsfinest Author: F Scott Fitzgerald Book title: T

0 0
Add a comment Improve this question Transcribed image text
Answer #1
-------------   Please find the solution for first please ask second one as separate question  ----- 
var deck = [];
var symbols = ['C', 'D', 'H', 'S']
for (var i in symbols){
   for(var j=1; j<=13; j++){
      deck.push(j + "" + symbols[i]);
    }
}
console.log(deck)
sample output:

2) 3H [1C, 2C, Зе, ac, c, c, 7c, 4H,5H, 6H,7H, 8H, 10H, C, 9C, 10C, 11C, 12c, 13c, lo,

Add a comment
Know the answer?
Add Answer to:
javascript questions Declare an empty deck array. Use a loop to fill the array with string values that represent the 52 cards of a normal deck. The numbers go from 1 to 13 with 1 for an ace, 11 for...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT