Question
Need help coding the following? Create a new pokerCard object named myStarterCard. Apply the shift() method to the cards array of myDeck to store the
Need help coding the following?
Create a new pokerCard object named myStarterCard. Apply the shift() method to the cards array of myDeck to store the first card from the deck in myStarterCard. Change the srcattribute of the newCard inline image by calling the cardImage() method for the myStarterCard object.
my js:
"use strict";
/*
New Perspectives on HTML5, CSS3, and JavaScript 6th Edition
Tutorial 14
Review Assignment
Author:
Date:
Filename: ag_squares.js
*/
window.addEventListener("load", playPokerSquares);
function playPokerSquares() {
var newCard = document.getElementById("newCard");
var startButton = document.getElementById("startButton");
var rowSumCells = document.querySelectorAll("table#grid th.rowsum");
var colSumCells = document.querySelectorAll("table#grid th.colsum");
var cardImages = document.querySelectorAll("table#grid tr td img");
var gameScore = document.getElementById("gameScore");
var gameResult = document.getElementById("gameResult");
}
// sets up the game
startButton.addEventListener("click", function() {
squareGame.gameTotal = 0;
squareGame.gameScore = "";
squareGame.gameResult = "";
for ( var i =0; i rowSumCells, colSumCells[i] = ''; } for ( var i =0; i } // method to randomly sort the deck this.shuffle = function(){ this.cards.sort(function) { return 0.5 - math.random(); }) // create a new deck of cards and shuffle it var myDeck = new pockerDeck(); myDeck.shuffle(); console.log(myDeck); });
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started