var array = ["object1","object2","object3","object4","object5"];
var copy = array.slice();
copy.forEach(function(value) {
if(value === "object3"){
value = "newObject3"
}
});
console.log(copy );
If i want to move object3
in the array to the first index, after i assigned it a new value. How do I do it? and Whats the most effective and less time? any libraries like lodash can be used.