Question: CGS 2 8 2 0 Java Script I need help with this assignment: simple codes please nothing fancy, no codes backtick pls . use strict;

CGS 2820 Java Script
I need help with this assignment: simple codes please nothing fancy, no codes backtick pls.
"use strict";
$(function(){
let ranks =['A','2','3','4','5','6','7','8','9','10','J','Q','K'];
let suits =['H','C','S','D'];
let images =[]
preloadImages();
//Set a variable called isShuffled to false
//Set a variable called numDealt to 0
//Set a variable called numCards to the number of
//elements in the images array. You are NOT allowed
//to set it to the number 52. Let JavaScript
//determine the number of elements.
//Set the text inside of the span with ID of numDealtSpan to 0.
//Set the text inside of the span with ID of numInDeckSpan to the number of cards.
//Assign the function called shuffleDeck to the click event of the button with ID of shuffleBtn.
//Assign the function called dealACard to the click event of the button with ID of dealBtn.
$('#resetBtn').click(function()
{
//Set the html of the element with ID of imageArea to the empty string.
//Reset the images array to the empty array.
//Call the preloadImages function.
//Set the isShuffled variable to false.
//Set the numDealt variable to 0.
//Set the text inside of the span with ID of numDealtSpan to 0.
//Set the text inside of the span with ID of numInDeckSpan to the number of cards.
});
function shuffleDeck()
{
//Set the html of the element with ID of imageArea to the empty string.
//Set the numDealt variable to 0.
//Set the text inside of the span with ID of numDealtSpan to 0.
//Set the text inside of the span with ID of numInDeckSpan to the number of cards.
//Define a variable called numCardsCopy and set its value to the value inside of numCards.
//Start a while loop that checks for numCardsCopy bigger than 0
{
//Define a variable called pos and set it to a call to the function randInt with parameters 0 and numCardsCopy.
//Define a variable called card and set it to the element of the images array at index pos.
//Set the element of the images array at index pos to the element of the images array at index numCardsCopy -1.
//Set the element of the images array at index numCardsCopy -1 to the card variable.
//Decrement numCardsCopy by 1.
}//end while loop
//Set isShuffled to true.
}
function dealACard()
{
//Define a variable named imageArea and set its value to the jQuery element with ID of imageArea.
//If the number of elements in the array images is 0 do:
{
//Set the html contents of the imageArea variable to the string "No more cards in deck."
//Get out of the function.
}//end of the if
//If the value in isShuffled is false do:
{
//Set the html contents of the imageArea variable to the string "Shuffle the deck first."
//Get out of the function.
}//end of the if
//Define a variable called image and set its value to the first element (THINK here) of the images array.
//Remove the first element of the images array.
//Set the html contents of the imageArea variable to the image.
//Increment the variable numDealt by 1.
//Set the text inside of the span with ID of numDealtSpan to numDealt.
//Set the text inside of the span with ID of numInDeckSpan to the number of elements in the images array.
}
function randInt(min, max){
//Generates a random number between min and max-1
return Math.floor(Math.random()*(max - min))+ min;
}
function preloadImages()
{
for(let r =0; r < ranks.length; r++)
{
let rank = ranks[r];
for(let s =0; s < suits.length; s++)
{
let suit = suits[s];
let imageSrc = "PlayingCardImages/"+ rank+suit+".jpg";
let imageTag = $("");
imageTag.attr("src", imageSrc);
imageTag.attr("id", rank+suit);
imageTag.attr("width",196);
imageTag.attr("height",300);
images.push(imageTag);
}
}
}
}); //last thing in the function that does everything

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!