Hi guys I am decently new to programming and this is my first post on stackoverflow, I am working on a small game that involves random cards to be drawn from an array.
Picture an array like this:
var cards = [document.getElementById("c1"),
document.getElementById("2"),
document.getElementById("3"),
document.getElementById("4"),
];
Now I have the following code to generate the random variable from the array:
var randomNum = Math.floor((Math.random() * cards.length));
I use:
document.getElementById(randomNum);
to select the random variable.
Now I want to select all the other variables in the array and give them the following code so there will only be one card displayed on screen at a time:
.style.display: "none";
Is this even possible? Thanks a lot!