Skip to content
Advertisement

Tag: indexing

Find remaining indexes and storing them as values

I’m making a small game. You have to find the ball under a randomized cup. First the images are stored in a nodeList. Then the winning cup is calculated randomly from the length of the nodeList. My problem: After the random value for winningCup has been calculated I don’t know how to find the other two indexes from the ‘images’

String index in a JavaScript array

I want to use a specific string in addition to a number to the index of array, I make like this ​ When I print out the tmpArray, it’s empty. Also the size is 0. When I remove the “elem” from the index of the array, it works properly. What should I do? Here’s a real example: http://jsfiddle.net/dfg3x/ Answer JavaScript

Advertisement