Prev Demo
Data Type When String Is Stored As A Value.
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <h1>Data type when string is stored as value</h1> <script> var name = "Sheo"; var anotherName = name; name.person = "Narayan"; alert(name + anotherName) console.log(anotherName.person); // Narayan console.log(name.person); //Narayan </script> <p><strong>Note:</strong> In the script code in code box, we have given value 'sheo' to the name variable, name value to the anotherName variable and name.person value equals to 'Narayan' is given, so the output single in name two times, either it may be 'Sheo Sheo' or 'Narayan Narayan'</p> </body> </html>
Note: We DO NOT save your trial code in our database.
Output