1.1. What is JavaScript

Invite teachers

1.1 What is JavaScript

JavaScript is a programming language initially designed to interact with elements of web pages. In web browsers, JavaScript consists of three main parts:
  • ECMAScript provides the core functionality.
  • The Document Object Model (DOM) provides interfaces for interacting with elements on web pages
  • The Browser Object Model (BOM) provides the browser API for interacting with the web browser.
  • JavaScript allows you to add interactivity to a web page. Typically, you use JavaScript with HTML and CSS to enhance a web page’s functionality, such as validating forms, creating interactive maps, and displaying animated charts.
  • When a web page is loaded, i.e., after HTML and CSS have been downloaded, the JavaScript engine in the web browser executes the JavaScript code. The JavaScript code then modifies the HTML and CSS to update the user interface dynamically.

The JavaScript engine is a program that executes JavaScript code. In the beginning, JavaScript engines were implemented as interpreters.
However, modern JavaScript engines are typically implemented as just-in-time compilers that compile JavaScript code to bytecode for improved performance.

JavaScript History

In 1995, JavaScript was created by a Netscape developer named Brendan Eich. First, its name was Mocha. And then, its name was changed to LiveScript.

Netscape decided to change LiveScript to JavaScript to leverage Java’s fame, which was popular. The decision was made just before Netscape released its web browser product Netscape Navigator 2. As a result, JavaScript entered version 1.0.

Netscape released JavaScript 1.1 in Netscape Navigator 3. In the meantime, Microsoft introduced a web browser product called the Internet Explorer 3 (IE 3), which competed with Netscape. However, IE came with its own JavaScript implementation called JScript . Microsoft used the name JScript to avoid possible license issues with Netscape.

Hence, two different JavaScript versions were in the market:
  • JavaScript in Netscape Navigator
  • JScript in Internet Explorer.
JavaScript had no standards that governed its syntax and features. And the community decided that it was time to standardize the language.

In 1997, JavaScript 1.1 was submitted to the European Computer Manufacturers Association (ECMA) as a proposal. Technical Committee #39 (TC39) was assigned to standardize the language to make it a general-purpose, cross-platform, and vendor-neutral scripting language.
TC39 came up with ECMA-262, a standard for defining a new scripting language named ECMAScript (often pronounced Ek-ma-script).

After that, the International Organization for Standardization and International Electrotechnical Commissions (ISO/IEC) adopted ECMAScript (ISO/IEC-16262).

To define a variable in JavaScript, you use var keyword. For example:

var x = 10;var y = 20;

ES6 added a new way to declare a variable with the let keyword:

let x = 10;let y = 20;
There are differences between var and let. And it’s a good practice to use the let keyword to declare variables.

To declare a function, you use the function keyword. The following example defines a function that calculates the sum of two arguments:

function add( a, b ) {return a + b;

To call the add() function, you use the following syntax:

let result = add(x, y);

To log the result into the console window of the web browser, you use the console.log() :

Invite teachers
Request Demo Access
You have the opportunity to use a 30-day demo access to familiarize yourself with the functionality of the platform