Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me out with these two JavaScript programming questions. its for exam review. let suits = [ Hearts', Spades', Clubs, Diamonds' ] ]!

Please help me out with these two JavaScript programming questions. its for exam review.

image text in transcribed
let suits = [ "Hearts', " Spades', "Clubs", "Diamonds' ] ]! let values = [ "Are' , 2, 3 , 4, 5, 6 , 7, 8, 9, " Jack", " Queen';king' ]` 4 . Create a constructor for a Card object . A Card has a suit , and a value . A card has the ability to check if it matches another Card object . A Card matches another card if it has the same suit or the same value . function Card ( suit , value ) {| this _ suit = let suitVang = Math. floor ( Math. random ( 7* 4 ) 7\\ let values Num = Math . floor ( Math . van dom ( $ # 12 ) ;^ this . suit = vsuits [ Suit Val ] ;] MEN new Card . suit function Card ( suit , value ) {| new Card . value this . suit = Swid ; this . value = value ; this . match = function ci E .. . } } Yet first Card = new Card ( suit Val, values Num ) let second Card = new Card ( suitVal , values Num ) if ( first Card . suit = = second Card . suit 11 first Card , value = = Second Card . value ){\\ return true ;] else Veturn false 5 . Write a function that returns how many Aces are in a card hand . Your function should accept an Array of Cards as a parameter and return how many aces are in that array

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions

Question

Write short notes on Marketing mix.

Answered: 1 week ago

Question

Analyse the process of new product of development.

Answered: 1 week ago

Question

Define Trade Mark.

Answered: 1 week ago