Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Copy by Value</title> </head> <body> <script> let message = "Hello World!"; let greet = message; // Assign message variable to a new variable greet = "Hi, there!"; document.write(message + "<br>"); // Prints: Hello World! document.write(greet); // Prints: Hi, there! </script> </body> </html>