JavaScript Introduction
What is JavaScript?
JavaScript is a widely used coding language to create interactive and dynamic websites. JavaScript is an adaptable code language that can be employed both on the client and server sides. From simple form validation to complex web-based games, JavaScript is an essential element when creating interactive web applications.
History of JavaScript
Brendan Eich, a developer at Netscape Communications Corporation, created JavaScript within ten days in May 1995. JavaScript had many different names initially, such as "Mocha" and "LiveScript," before Netscape finally settled on the name "JavaScript." JavaScript appeared for the first time in Netscape Navigator 2.0, which was the most used browser at that time. Netscape submitted JavaScript for standardization to the European Computer Manufacturers Association (ECMA) in 1996. The standardized language was called ECMAScript.
Features of JavaScript
- Interpreter: JavaScript is an interpreted language, and it is executed immediately by a web browser without the necessity of any additional compilation.
- DOM Manipulation: JavaScript can control the Document Object Model (DOM), which defines the structure of a web page.
- Event Handling: JavaScript enables programmers to create event handlers to react to various user actions and events, including button clicks and form submissions.
- Case Sensitive: JavaScript is a case-sensitive language.
- Control Statements: JavaScript supports control statements like if-else-if, switch case, and loops. These control statements enable users to develop complex programs.
- Dynamic Typing: JavaScript is a dynamically typed language, meaning you don't have to declare data types when you declare variables.
How to add JavaScript in html document ?
The <script>
tag is utilized to incorporate JavaScript code within an HTML
document.
Example: