- It is well-suited for performing task within a web browser.
- It can easily detect what browser a person is using and customize the web pages to their browser.
- It is easy to debug and find errors
- You don’t need to have a fancy computer, as long as your computer is support web browser.
Setup Working Environment
- Web Browser – I would recommend to use Google Chrome Browser.
- Code Editor – Either NotePad++ or Visual Studio Code is fine.
Writing First Program
Create A Pop Up Alert Box
alert("Hello, this is Jorcus!");
document.write("Hello, this is Jorcus! This will overwrite");
NOTE: If you running this script after the entire HTML page loaded, it will delete the entire existing HTML and overwrite with new content.
Testing and Debugging
Single line comments
// Pop up a message to the visitors. alert("Hello Jorcus!");
Multi line comments
/* The code below will change pop up a message with alert box and an OK button */ alert("Hello Jorcus!");