Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Global Variable</title> </head> <body> <script> let greet = "Hello World!"; // Defining function function greetWorld() { document.write(greet); } greetWorld(); // Prints: Hello World! document.write("<br>"); document.write(greet); // Prints: Hello World! </script> </body> </html>