java-script:hello-world
This is an old revision of the document!
Java Script Hello World
The following script will display 'Hello World' both in a popup window and in the browser's console. To execute the script, it must be run within a web browser.
You can view the console output by accessing the browser's developer tools.
- hello-world-js.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Hello World!</title> </head> <body> <h1>Hello World! from JS in a script tag</h1> <script> alert('Hello world!'); const h1 = document.querySelector('h1'); console.log(h1.textContent); </script> </body> </html>
java-script/hello-world.1691522028.txt.gz · Last modified: 2023/08/08 22:13 by odefta