It is free to use for everyone.
- It is a light-weighted and interpreted language.
- It is a case-sensitive language.
- It provides good control to the users over the web browsers.
This will change the element content (innerHTML) to “Peaceful Warrior”.
document.getElementById("demo").innerHTML = "Peaceful Warrior";
change the style of an HTML element.
document.getElementById("monk").style.fontSize = "45px";
This will hide an HTML element of Id = “monk”.
document.getElementById("monk").style.display = "none";
- Less server interaction − You can validate user input before sending the page off to the server. This saves server traffic, which means less load on your server.
- Immediate feedback to the visitors − They don’t have to wait for a page reload to see if they have forgotten to enter something.
- Increased interactivity − You can create interfaces that react when the user hovers over them with a mouse or activates them via the keyboard.
What makes JS unique ?
- Full integration with HTML/CSS.
- Simple things are done simply.
- Support by all major browsers and enabled by default.
Next topic – Where to write JS