js reorder elements in an array code example
Example: javascript array reorder elements
Array.prototype.move = function (from, to) {
this.splice(to, 0, this.splice(from, 1)[0]);
};
Array.prototype.move = function (from, to) {
this.splice(to, 0, this.splice(from, 1)[0]);
};