Prev Demo
Prmitive Data Type String Is Stored A S Value
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <h1>Primitive data type string is stored as value</h1> <script> var name = "Sheo"; var anotherName = name; // i.e anotherName = the value of name name = "Narayan"; // value of name changed alert(anotherName + name) console.log(anotherName); // Sheo console.log(name); //Narayan </script> <p><strong>Note:</strong> Observe the code in the code box carefully, we have given value <i>'sheo'</i> to the name variable, value of the name is given to the anotherName variable.<br> So, the alert returns full name 'Sheo Narayan'. </p> </body> </html>
Note: We DO NOT save your trial code in our database.
Output