client-side scripting language, i.e., it gets executed within the client's(user) browser. It creates interactive webpages and adds dynamic effects to them.
- In 1995,
Netscape competed with Microsoft. That is why they approached Sun Microsystems, which was about to launch a new programming language
JAVA. Java was a programming language that had all the features of Object-Oriented Programming.
- Java was used for system programming and
applet development. However, there was still a need for a scripting language for websites to enhance the
user’s interactivity. Netscape, in collaboration with Sun Microsystems, developed LiveScript for its browser to compete with Internet Explorer of Microsoft..
- It reads the script (Parsing).
- Then, it converts or compiles the script to machine language.
- Execution of the script by the machine.
- Client-side form validation.
- Performing Event-based actions.
- Dynamic drop-down menus.
- Displaying date and time.
- Displaying popup windows and dialog boxes (like an alert box, confirm box and prompt box).
- Adding, removing, or hiding elements from the webpage.
- JS allows Dynamic Typing; i.e., a variable's type is not needed to be declared.
- It is a case-sensitive language.
- It can react to user operations to increase interactivity, like a mouse click or keypress.
- It can perform form validation before submitting the data to the server.
- It can set cookies in the browser.
- Supports the storage of data in the local storage.
- It has inbuilt functions to perform different operations.
- It supports Object Orientation but does not use classes.
- Less server interaction: JS does client-side validation, which means it validates the data before sending it to the server. Hence, the user interacts with the server only when all the data gets validated. It saves server traffic, which means less load on the server.
- Creates interactive pages: It creates interactive pages that react to the user’s operations. For example, an event gets triggered when the user hovers over any page element or pressing a keyboard key.
drag-and-drop components and
sliders, which provide a rich interface to the users.
- Back-end Data Loading: The
- It does not support multi-threading and does not have multiprocessor capabilities.
Look at the
The type attribute for <script>
is no longer required in HTML5