How can you change the index of multiple array objects?

Problem: How can you change the index of multiple objects within an array of 100 objects? In my case I would like to push them to the end of the array. I have fetched a json array that contains over …

How to get an index of an array element within a sort comparison function?

I am looking at this question: The sort method for arrays can take an argument that is a comparison function with two parameters—say, x and y. The function returns a negative integer if x should come …

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’ nodeList. How can I calculate for two values that AREN’T the randomized winningCup’s value? My thought was to issue some kind of check, but I’m not sure what to check for. My goal for this is to have the two

Finding all indexes of a specified character within a string

For example, if I had “scissors” in variable and wanted to know the position of all occurrences of the letter “s”, it should print out 1, 4, 5, 8. How can I do this in JavaScript …