Javascript String Question 3

Introduction

What is the output of the following code?

let myString1 = "Hello World";
let myString2 = myString1;
myString1 = "Hello Universe";

console.log(myString2);


Hello World

Note

If strings were reference types, the code above would not work.




PreviousNext

Related