I am working on an javascript app and having some trouble with the object constructor. I am going to make each card in the deck an object and so just working on building an array of those objects. Here is what i have :
function card(suit1,number1) // Constructor
{
this.suit1 = suit1;
this.number1 = number1;
}
function makeDeck1() {
var deck1 = new Array()
deck1[0]= new card('S','A');
deck1[1]= new card('S','1');
}
function myFunction() {
makeDeck1();
alert('gman' + deck1);
}
<h2>Blackjack</h2>
<button onclick="myFunction()">Click me</button>
basically the console is telling me that "deck1" is not defined...so something is wrong with the process...
was wondering if anyone can shed any light on this.
Thanks! G