Introduction to Javascript

In this article, we’d like to introduce you to JavaScript. It is one of the most famous & commonly used languages. Today Javascript powers millions of web pages and makes them interactive. It helps validate forms, run business logic on the client, create cookies, animate, and more. It runs on all devices, including Windows, Linux, Mac, Android, iOS, etc., and is supported by all browsers.

What is Javascript

Javascript is the scripting language, we use to make web pages interactive. It is written in plain text on the HTML page and runs in the browser. Modern JavaScript evolved so much that, it can run on the server side today. We use it along with HTML & CSS and powers the entire web.  

History

Brendan Eich of Netscape developed JavaScript for Netscape in 1995. It started as Mocha, then became LiveScript, and later JavaScript.

Java was a very popular language at that time. Hence the marketing folks at Netscape decided to name it JavaScript to encash Java’s popularity. They also designed it so that its syntax looks similar to that of Java.

Microsoft included support for JavaScript (named JScript) from Internet Explorer 3.0. It also had its scripting language VBScript. Other browsers also incorporated JavaScript, while VBScript remained only with Internet Explorer. This eventually led to the demise of VBScript.

The browser vendors started to come out with their implementation of JavaScript. Since there was no standard, each browser was free to implement. Hence the need for standardizing the syntax & rules of JavaScript.

In 1997. Netscape presented JavaScript to ECMA International, which standardized the specifications of the JavaScript under the name ECMAScript specifications (pronounced as “ek-ma-script”). The browsers now implement Javascript using ECMAScript specifications, which is why the JavaScript programs behave similarly across all browsers.

How it is Used

We use JavaScript to create and manage dynamic web pages. It works side by side with HTML & CSS.

The HTML provides the content & structure of the web pages. You can create content using headings, paragraphs, tables & images, etc.

The CSS controls how the Web looks like. You can set color, font styles, backgrounds, borders, etc.

JavaScript makes it dynamic. Using JavaScript, you can respond to user events, Take input from the user, Validate those inputs, run business logic, read and send data to the servers, etc. It can also alter the content & look by manipulating the HTML & CSS on the fly.

Creating a JavaScript Program

There are two ways you can include JavaScript. You can embed it directly inside an HTML Page or Include it as a separate file.

The following is an example shows how you can write JavaScript directly in an HTML file

Source Code

Copy the above code to any text file and name it as index.html. Open it in any browser and you will see the following in your browser

Note that we do not have to do anything to make the above code run. The browser will read the <script> tag and recognize the content as JavaScript code and executes it.

JavaScript is an interpreted language

JavaScript is an interpreted language. We cannot compile a JavaScript program into an executable. We distribute it as plain text.

To run an interpreted language, the client machines require an Interpreter. The Interpreters read the program line by line and execute each command. The Interpreted languages were once significantly slower than compiled languages.

Every browser comes with a built-in Interpreter in the form of a Javascript virtual machine

Javascript virtual machine

The JavaScript virtual machine (JVM) is the component of the browser that reads our JavaScript code, optimizes, and executes it.

The job of JVM is to Interpret the JavaScript code and run it. Each browser comes with a version of JVM. The following are some of the popular JVM

  • V8 — Developed by Google for chrome.
  • Rhino — Developed by Mozilla Foundation for Firefox
  • SpiderMonkey — The first JavaScript engine, used by Netscape Navigator, and today powers Firefox
  • JavaScriptCore — Developed by Apple for Safari
  • Chakra — Developed by Microsoft and runs on Microsoft Edge
  • JerryScript — is a lightweight engine for the IoT devices

Javascript Tools & Frameworks

Many tools, Libraries & Frameworks are available, making working with Javascript easier.

JavaScript framework is an application framework written in JavaScript. It contains tools & libraries and defines the entire application design.

The following are some of the popular JavaScript libraries & frameworks

Javascript Transpilers

A JavaScript Transpiler is a tool that reads source code written in a different programming language and produces an equivalent code in Javascript.

Learning Javascript

Javascript Reference

1 thought on “Introduction to Javascript”

  1. Very informative blog. Everything in this blog about JavaScript is well explained. Thank you so much this amazing post. Keep posting and keep it up dear.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top