What are the features of JavaScript?
This article is about the what are the features of javascript in web technology. Before we learn to code in any language, we need to understand its features.
- Javascript is a simple and easy-to-learn language.
- It is a powerful lightweight client-side scripting language.
- It is a high-level interpreter-based prototype or object-based scripting language or programming language.
- Javascript is a cross-platform or portable case-sensitive weekly or untyped browser independent not fully secure scripting language.
- Javascript is one of the standard scripting languages.
Let’s see each of these features step-by-step in detail.
Simple and Easy
Javascript is a simple and easy-to-learn programming language.
Its programs or scripts contain English like commands/instructions, hence easy to learn, code, understand, modify, debug and test. Javascript is a simplified version of the java programming language. If you compare the constructs of javascript and java they look quite similar.
Powerful
Javascript is a powerful and popular language. It provides a rich set of operators to perform operations on various types of data. for example, javascript provides arithmetic operators to perform addition, subtraction, multiplication, and division operations on numbers. JavaScript provides logical operators to perform Boolean operations. It provides comparison operators to compare two data and many operators.
Javascript provides a rich set of control statements to control the flow of execution of the code, for example, javascript provides conditional statements using them, based on the result of the condition we can skip or execute a set of instructions. It provides looping statements using them we can execute some set of instructions repeatedly etc.
JavaScript provides array construct to create lists and tables and perform various operations like searching, sorting, merging, etc. on them. JavaScript provides various built-in objects. They can be reused to get solutions to many tasks quickly. It provides DOM objects to control and add more behavior to the browser.
Lightweight
JavaScript codes take very less memory footprint for execution. And JavaScript is a simple and small language, hence it is considered a lightweight language.
Scripting language
Javascript is a scripting language, we know that codes placed within another document for execution are generally called scripts. scripts depend on another file for their execution. As JavaScript codes are placed within HTML documents for execution. We can say javascript codes are called scripts, not programs.
Scripting languages are designed to extend capabilities or add behaviors to already built applications. As javascript is used to add behaviors to HTML elements, we can say javascript is a scripting language.
Client-side scripting language
It is one of the main features of javascript. Javascript codes are not executed on the server instead they are executed on the client machines by users’ browsers (AKA Client software/browsers). As javascript codes are executed on the client side not on the server side, we can say javascript is a client-side scripting language.
Interpreted language
In most other programming languages like c, c++, python, etc their codes need to be compiled first for their execution. Whereas Javascript codes need not be compiled, because the browser interprets and executes javascript codes line by line on the fly. But modern javascript codes are compiled to an intermediate byte code and then interpreted and executed by the javascript engine available in modern browsers.
Prototype or object-based
In object-oriented programming languages, objects are created by creating new instances of classes whereas Javascript is a prototype-based language. Hence, in javascript objects are created by creating new instances of prototypes instead of classes. As JavaScript is an object-based language, it has no object-oriented concepts like class, inheritance, polymorphism, dynamic binding, etc. But object-oriented concepts are simulated through the use of prototypes in JavaScript.
Case sensitive
Javascript is case sensitive scripting language. It treats lower case letters and upper case letters separately or differently. For example, If we create three identifiers num, NUM, and Num, then they are considered three different identifiers. Because they might have the same spelling but they are defined differently using upper case and lower case letters. In javascript lower case letter “a” and upper case letter “A” are completely different.
While programming in JavaScript anything needs to be written in lower case letter, must and should be written in the lower case letter and anything needs to be written in upper case letter must and should be written in uppercase letters. So, Javascript is case sensitive but HTML is not case sensitive language, you can write tags in uppercase or lowercase in HTML.
Weakly or un-typed language
In javascript, while creating variables, constants, or parameters programmers need not explicitly define their data type. JavaScript automatically figures out the data type based on the type of value stored in a variable, constant, or parameter. Languages in which datatypes need to be explicitly defined are known as strictly typed or strongly typed language.
Browser Independent
To execute JavaScript code browsers need not install any extra plug-in. Today, almost all browsers have a built-in JavaScript engine. To execute JavaScript codes, the user just needs to enable it in browser settings. By default enable the JavaScript if it is the disabled user just needs to enable it to execute javascript codes.
As javascript has become the standard scripting language today we have server-side javascript also. Server-side JavaScript codes are executed on the server side, only the result of execution will be sent back to the client machine.
Not fully secure or safe
As javascript codes get downloaded on the client machine and then get executed. Sometimes other malicious or harmful codes can also get downloaded with them, hence it is not a fully secure language. But modern browsers execute Javascript codes in a sandbox and check for malicious and harmful codes, hence modern javascript is considered a secure or safe language.
Javascript is a cross-platform or portable language, which means we need not write separate codes for different platforms without modifications. We can port the codes and execute them on browsers and different platforms. And it is a high-level scripting language, as it is English-like statements, instructions or commands are going to be similar to English, like statements. Javascript is more programmer-friendly than machine friendly, we can consider it as a high-level language.
Conclusion
I hope you guys have understood all the features of javascript.