Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Using a Variable Before it is Declared</title> </head> <body> <script> str = "Hello World!"; document.write(str); // Prints: Hello World! var str; </script> </body> </html>