What is Javascript?
Javascript is one of the most popular and widely used programming languages across the globe.
It is the only language that is understood by a web browser. Every browser has a builtin javascript engine that translates and executes the code.
Example,
Firefox engine is named SpiderMonkey,
Chrome has a V8 engine, and
IE has Chakra.
Javascript is very lightweight, thus using it in your web applications does not impact their performance.
Companies like Netflix, PayPal, Walmart etc., heavily use it.
What can you do with Javascript?
Javascript can transform a web application into a highly interactive and dynamic application. Below is a list of things that javascript can do.
1. Validate user input
Almost all web applications accept user input such as a registration form, booking details, Captcha verification etc.
User can input any data that needs to be validated before saving it and many times it is not affordable (due to network bandwidth or security measures) to send the data to the server, validate it there and send error message if the data is invalid.
Javascript can perform validation tasks at the client(or browser) side only and report error without sending any data to the server.
2. Making applications dynamic
Javascript can hide or show web elements. It can be used to show elements only when they are required.
Example, registration form should be displayed only when user opts to register.
Thus, javascript can make the applications highly dynamic.
3. Validate missing values
Often before submitting a form, users forget to enter some mandatory information. Javascript can catch any such instances and display the warning which would otherwise result in sending it to the server and then displaying error leading to increased wait time for the user just to see an error message due to his mistake.
4. Dynamic server interaction
Suppose there is an application which asks you for your phone number and fetches your entire details registered with this number.
With AJAX support in javascipt, it can interact with the backend server, fetch and show the details right below without actually refreshing the page enhancing user experience.
5. Autocomplete input options
When typing a search string in Google, it displays a list of keywords related to the search string while typing. How convenient it seems!!!
This also involves javascript behind the scenes.
6. Adding animations
With javascript, you can also add animations to web pages which is an important required while creating games.
Javascript code execution
As stated earlier, javascript is executed inside a browser by a javascript engine.
Till 2009, javascript code could only be executed inside a browser. Thus, by learning javascript you could only work as a frontend developer.
In 2009, Ryan Dahl took chrome’s V8 engine, embedded it inside a C++ program and created Node which made it possible to execute javascript code outside the browser also.
Meaning that javascript can also be used to create server side applications.
This means that by learning javascript now you can work both as a frontend and backend developer.
ECMAScript vs Javascript
Many new learners have a confusion between ECMAScript and javascript.
Many consider it as same language, many think they are different.
But wait!!! both are not true.
ECMAScript is not a programming language, it is a specification defined by an organization named Ecma.
Javascript is a programming language that follows it. ECMAScript defines standards and javascript follows it.
You can say javascript is written as per those standards or javascript is an implementation of ECMAScript.
ES6
Nowadays a lot of buzz about ES6 is being heard which raises doubts for those learning javascript.
As mentioned above, ECMAScript is a standard for javascript. It keeps on publishing its editions in which it suggests some changes in specifications.
In June 2015, it released its sixth edition which had significant new features and enhancements for javascript such as classes, modules, arrow functions, let
and const
for variable declarations etc.
Since it had major new inclusions, it came to be known ES6(due to 6th edition).