Header add


In this article we will discuss what is JavaScript and why it is used. We cover below points in detail
  • History of JavaScript,
  • How JavaScript was designed?
  • What is JavaScript?
  • What JavaScript Can do For us?
  • Understanding ECMAScript.
  • How does JavaScript Engine work?
  • What makes JavaScript unique?
  • What is Validation?
  • Why do we need both client-side and server-side validation?
  • Advantages and Disadvantages of using JavaScript.
  • What software can be used for JavaScript programming?
  • What should we know before learning JavaScript?
JavaScript is a client side scripting language which is used for creating web pages. It is a standalone language developed in Netscape. It is used when a web-page is to be made dynamic and add special effects on pages like rollover, roll out and many types of graphics.


History of JavaScript:




Timeline History:

1995 JavaScript was born and was created by Brendan Eich, a Netscape Communications Corporation programmer. Brendan Eich took only 10 days to develop the Scripting language which was then known as Mocha. The scripting language name was changed from Mona (and LiveScript) to JavaScript.

JavaScript’s original name was Mocha. JavaScript has nothing to do with Java. Java was famous in that era, hence the name “JavaScript” was chosen to ride on Java’s success. Microsoft created a reverse-engineered version of JavaScript, known as JScript.

1996 JavaScript is handed to ECMA. The Scripting language was given the name “ECMAScript” officially; however, people still call it JavaScript. In 1996-1997 JavaScript was taken to ECMA carve out standard specifications. ECMAScript is the name of the official standard, with JavaScript being the most well-known of the implementation, other implementation includes ActionScript3.

1998 ECMAScript 2 is released.

1999 ECMAScript 3(baseline for modern-day JavaScript) is released. This released evolved into what is today’s modern JavaScript.

ECMAScript5 was released in December 2009.

The JavaScript community flourishes. The community’s impact peaked with a paper released in 2005 by Jesse James Garret describing a set of technologies that JavaScript supported as a backbone and where he created the term ‘Ajax’. Additionally in 2005, jQuery, Prototype and Dojo were released.

ECMAScript 4 never happened.

We are at ECMAScript 6 (Officially: ECMAScript 2015), also known as ES6.

92% of all websites use JavaScript including some of the world’s biggest websites such as Google and Facebook.

How JavaScript was designed ?

In 1995 Netscape made the best browser in the world and have received market dominance.so they thought the browser/server combination as a new kind of distributed operating system. Browsers had the potential to let developers reach users on any platform such as Windows, Mac, or Linux .but the missing contents were a programming language. What Netscape wanted was a language to complement Java that would appeal to beginning programmers.

Netscape hired Eich in 1995 because they wanted him to create a programming language for that web browser.

JavaScript evolve and started as Mocha, then became LiveScript and then became JavaScript when Netscape and Sun got together. They did a license agreement and it became Javascript.

They aimed to provide a “glue language” for the Web designers and programmers who were building Web content from components such as images, plugins, and Java applets. They found Java as the “component language” used by higher-priced programmers, where the glue programmers – the Web page designers – would assemble components and automate their interactions using JS.

JavaScript was specifically developed to be a language place into a web browser and automate things on the client-side, such as, animating drop-down menus, validate form input before submitting to the server or manipulate the document object model (DOM). In the beginning, that was all it was meant to do.

Then came AJAX (Asynchronous JavaScript and XML). AJAX-enabled the browser to talk directly to an executable on the server, fetch data and populate the DOM so that new content could be pumped in/removed from the page. This made JavaScript an essential component of the browser.

Then came Google’s Version 8 JavaScript engine and node.js and it really became a lot more interesting. This made easy to write server-side code in JavaScript.

JavaScript is the only language that runs both on the server and the browser. Firefox OS has all apps written JavaScript. We can write JavaScript apps for Android and iOS.

With the rise of WWW and the internet both, JavaScript became the most popular programming language in the world. Today we even create frameworks and implement animations using JavaScript.

What is JavaScript?

JavaScript is one of the most popular and used programming languages in the world. It is a lightweight, interpreted, open and cross-platform programming language.

JavaScript is completed object-based scripting language produced by Netscape for use within HTML documents and enables interactions with web pages in various unique ways.

JavaScript became an independent language with its own specification called ECMAScript, it is an implementation of ECMAScript standard.

What JavaScript Can do For us?

JavaScript is basically used to make the web pages dynamic, interactive, and also add special effects on a page such as a rollover, rollout and many graphics. such as
  • used to insert dynamic text into the HTML (ex: Name, Address, etc.)
  • react to events (for example, load the page only when the user click on a button)
  • JavaScript also used to fetch the information of the user’s computer such as which browser the user using.
  • It also used to perform some calculations on the user’s machine such as validating the user input.
  • Animated/dynamic drop-down menus
  • Displaying clock, date and time.
  • Get and set cookies, ask questions to the visitor, show messages.
  • Remember the data/info on the client-side (“local storage”).
JavaScript is a CS (Client-Side) scripting language. It is in no way related to Java as its name implies, but it is used for client-side scripting.

Client-Side scripting, means the ability to manipulate data, the DOM and a webpage as a whole, without having a backend service or language.

We can make calculations, validate a form or any input field, include some logic that runs when a condition is met, also can manipulate the webpage and add a lot of function to a website without any SS (Server-Side) language.

On the introduction of frameworks like Node.js, JavaScript started using server-side technology. The Node.js changed the way JavaScript was used. It allows the use of JavaScript on the server-side while APIs, which lead the MEAN way for developing software where secured, database connected app could be written using JavaScript.

With the new development, not only web-based applications can be developed using JavaScript, even desktop-based (Electron), hybrid mobile app (Ionic), the real-time app can be developed as well.

It’s the only language used on the client-side which is supported by all browsers. The complete JavaScript implementations are made up of three distinct parts:
  • The Core(ECMAScript)
  • The Document Object Model(DOM)
  • The Browser Object Model(BOM)
ECMAScript is simply a description, defining all the properties, methods and objects of scripting language.

  • Syntax
  • Data Types
  • Statements
  • Keywords
  • Reserved Words
  • Operators
  • objects

Each browser has its own implementation of the ECMAScript interface, which is then extended to contain the DOM and BOM. Today, all popular web browsers comply with the 3rd edition of ECMA.

  • DOM (we will discuss later)
  • BOM (we will discuss later)

JavaScript is easy to learn but very powerful just because the entire Internet can’t run without it. The entire web site will become static without it. In Today’s world, there are so many JavaScript libraries or frameworks available. Some of them are listed below.

  • NodeJS
  • AngularJS
  • ReactJS
  • VueJS
  • EmberJS
  • MeteorJS
  • BackboneJS
  • ExpressJS
  • WebRxJS
  • jQuery

The Programs written in JavaScript language are called scripts. They can be written directly in web page HTML and run as the page loads.
Scripts are executed as plain text and don’t need any compilation to run. Today JavaScript can run not only in the browser but also on a server or any other device that has a special program called the JavaScript Engine.
The browser has an embedded engine called “JavaScript Virtual Machine”. The different browser has a different engine. And different engines have different “codenames”. For example:

  • V8 – in Chrome and Opera.
  • SpiderMonkey – in Firefox.
  • “Chakra” for IE, “ChakraCore” for Microsoft Edge, etc.

How does JavaScript Engine work ?

The Engine works once we write JavaScript code.

The JavaScript Engine (parses) read the source code (script).
Then its compiles (convert) the JavaScript code into machine language at the execution by implementing Just-in-Time (JIT) compiler.
And then the machine code runs.
The JavaScript engine applies optimizations at each step of the process. It watches the compiled script as it runs, analyses the data that flows through it, and further optimizes the machine code based on that knowledge.

What makes JavaScript unique?

JavaScript is the only browser language that combines below three things and that’s what makes it unique.

JavaScript is fully integrated with HTML/CSS.
Simple’s things are done easily.
It’s supported by all the browsers and enabled by default.

What is Validation?

It’s a process of testing and ensuring that data inserted by the user into an application are required and satisfies defined formats and other input criteria.so that only valid data can be submitted to a web application by end-user.

Why do we need both client-side and server-side validation?
Validation can be performed either on the server-side or client-side (user browser).

Client-side Validation:

In client-side validation, all the input data validation and error recovery are carried out by on client-side i.e. user browser using JavaScript.
It works fast and easier for the end-user.
It is generally insecure as the user has easy access to the code of the page.
It is used to reduce the errors that might come during server-side processing.

Pros:

It works very fast
It minimizes the errors

Cons:

It has low security

For Example: If a user enters an invalid email address and move to the next field, we can show the error message immediate right after, so that the user can correct the field before submitting the form. Whereas if we validate the same on the server, we have to submit the form to the server, the error message gets to display and then we can correct the wrongly entered the field.

Server-side Validation:

In server-side validation, all the input data validation and error recovery are carried out by on the server-side i.e. user browser using programming language like C#.net, Java, etc.

It works comparatively slower for the user.
It is more secure as the end-user does not have easy access to the code.
It is used to rescue any type of damage which can come during client-side validation.
Pros:

It has high security

Cons:

It is slow in execution. As every time request will be sent to the server for validation.
Note: Both types of validations play important roles but the most preferred one is the server-side is that the client-side validation can be bypassed/modify if JavaScript is turned off (disable) in the user browser.in this client-side validation won’t work hence it becomes useless. That is why we need a server-side to check the data value as well.

But we need to do both as client-side give immediate validation response to user input without having to wait for the page to load. Whereas the server-side will always capture the validations which are not caught by the client-side validation.

Advantages and Disadvantages of using JavaScript:
Advantages:

  • Runs Fast: The JavaScript code runs without contacting the server.
  • Platform Independent.
  • Easy to Learn.
  • Increased interactivity: we can create an interface that reacts when the user interacts like hovering them with a mouse.
  • Less Server Interaction: we can validate the user input before submitting the page to the server. This saves server traffic that means less load on the server.
  • Immediate feedback to the user: we don’t have to wait for a page to load to check if any wrong data got entered.
  • Rich Interface: Using JavaScript we can build rich user interfaces such as drag-and-drop components and sliders.

Disadvantages:

We can’t consider JavaScript as a full-fledged programming language as it has lacked in feature such as:

  • Run-on Single thread: JavaScript doesn’t have multithreaded and multi-process capabilities.
  • Read/Write Files: JavaScript doesn’t allow reading or writing files due to security concerns.
  • Networking Application: We cannot use JavaScript for networking related applications.
  • Code is not hidden: Even we can minify JavaScript code, the code is always visible to Client end
  • What software can be used for JavaScript programming?

As we know JavaScript is client-side scripting that runs by web browsers. To write a program in this language we can use the following software’s:

Chrome as a web browser + browser console to debug.
Any text editor like Notepad /Notepad++
OR
Visual studio

Post a Comment

Previous Post Next Post