JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://getfirebug.com/firebug-lite-debug.js"></script>

JavaScript

function update(array) {
    newArray = [2];
    newArray[0] = "myself";
    newArray[1] = "version2";
    array = newArray;
};

var array = ["myself", "version1"];
console.log(array);
update(array);
console.log(array);