We use the subscript syntax to replace elements in an array. Using the subscript, we pick the element of the array we wish to update and then use the assignment operator to assign a new value. The following example shows how we will replace a value in an array:
var arrayOne = [1,2,3] arrayOne[1] = 10 //arrayOne now contains 1,10,3
You cannot update a value that is outside the current range of the array. Attempting to do so will throw the same Index out of range exception that was thrown when we tried to insert a value outside the range of the array.