I guess i do something stupid so forgive me, but both methods don't change anything .
I want to move element from certain index - into index 0 . I have an array with 2 elements .
first way
console.log(index); //1
console.log(localProductPhotos);
localProductPhotos.unshift(localProductPhotos.splice(index, 1)[0]);
console.log(localProductPhotos);
array will stay/print the same order
second way
Array.prototype.move = function(from, to) {
this.splice(to, 0, this.splice(from, 1)[0]);
};
localProductPhotos.move(index,0); //index prints 1
both cases the array prints the same order.
EDIT:
This is the print:
EDIT: The above works on a simple array of strings, but my array is array of blob files as you can see in the photo.
var localProductPhotos=[];
//...
localProductPhotos.push(file);