How to make a var equal another var

I want to know how to make it so a var = var in a situation like this
var text = “code”
var copy = text[0];
then if you changed the value of var copy to for example a uppercase C would it change the text string too so the text string would have the uppercase c??? Thats what i was asking. I can show you my project if you need

It looks like you did it.

then if you changed the value of var copy to for example a uppercase C would it change the text string too so the text string would have the uppercase c???

No, because this is a primitive type. If you were dealing with a reference type (objects, arrays, etc.) then yes, changes to the copy can affect the original.

In case of reference type (array, object) it’s not a copy tho

let arr = [1,2,3]
let copy = arr;

in this case the variable copy is not actually a copy, it’s a second name for the same array
and you can do stuff like

arr[0] = "fun"
copy.push("more fun")
console.log(arr) // ["fun", 2, 3, "more fun"]