Let us say, we have a Array that contains three names, Mohan, Kriti and Salim. And we want to replace the name Kriti with a new name Paul.
<html>
<body>
<script>
var x = ["Mohan", "Kriti", "Salim"]
x[1] = "Paul"
document.write(x)
</script>
</body>
</html>
So, in the above code we have created a Array and initialised to the variable x.
var x = ["Mohan", "Kriti", "Salim"]
Now, let us see, how the values are positioned in the Array

Now, if we see the above diagram, Kriti resides at position/index 1. So, what we do is, just replace the position/index 1 (i.e. x[1]) with the new name Paul.
x[1] = "Paul"

And we get the below output,
Mohan,Paul,Salim
Let us take the same example, in which we have a Array that contains three names, Mohan, Kriti and Salim. And we want to replace the name Kriti with a Array with another Array that has two names, Rishav and Rishav.
<html>
<body>
<script>
var x = ["Mohan", "Kriti", "Salim"]
x[1] = ["Rishav","Rishav"]
for (let i =0; i<x.length; i++)
document.write(x[i], "</br>")
</script>
</body>
</html>
So, in the above code we have created a Array and initialised to the variable x.
var x = ["Mohan", "Kriti", "Salim"]
Now, let us see, how the values are positioned in the Array

Now, if we see the above diagram, Kriti resides at position/index 1. So, what we do is, just replace the position/index 1 (i.e. x[1]) with the new Array that has two names, Rishav and Rishav.
x[1] = ["Rishav","Rishav"]

And we get the below output,
Mohan Rishav,Rishav Salim