Quantcast
Viewing all articles
Browse latest Browse all 131

Arrays and Classes Javascript

Here is a class Card and a 2d array aGrid. The 2d array aGrid is set to `aGrid = new Card[4,4];` it looks like it's made into an instance of the Card class and an array at the same time. How does this work?? It looks like **new Card** is making aGrid into a instance of the Card class. Is it not? If not, what is it doing??? Along with that I know [4,4] is setting how much the array can hold. If new Card is making it into an instance of the card class, how can aGrid be an instance of the Card class and an array at the same time? Here is the code: class Card extends System.Object { var isFace:boolean = false; var isMatched:boolean = false; } var aGrid:Card[,];//2d array to keep track of the shuffled, dealt cards var aGrid = new Card[4,4];

Viewing all articles
Browse latest Browse all 131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>