Hello, how can I swap 2 elements of an array (the index)? The code I am using now is:
var temp = kartsRankingArray[o];
kartsRankingArray[o] = kartsRankingArray[o+1];
kartsRankingArray[o+1] = temp;
It works, but I am not sure. Won't this swap the contents of the objects instead of swapping the indexes of the objects in the array? Thanks! -- Leo ;)
var temp = kartsRankingArray[o];
kartsRankingArray[o] = kartsRankingArray[o+1];
kartsRankingArray[o+1] = temp;
It works, but I am not sure. Won't this swap the contents of the objects instead of swapping the indexes of the objects in the array? Thanks! -- Leo ;)