change javascript array in place code example Example: modify array js let newArray = oldArray.map(funcToEachElem);