An Intro to Javascript: Its History and Attributes

Ebubechukwu Ezike
5 min readDec 3, 2022

--

If you’re a beginner developer, say on the front end, you know that knowing HTML and CSS only scratches the surface. Understanding Javascript, its attributes, and implications is critical for taking your career to the next level.

Why, you might ask?

A styling sheet and markup language, on the other hand, have few interactive features.

Furthermore, they are limiting. Javascript, on the other hand, allows you to create not only interactive webpages, but also web applications, games, and much more.

I mean, how awesome is that? If this isn’t enough reason for you to learn, consider this advantage, cash.

In the US, a javascript developer’s annual salary is around $75,000 on average.A report by HackerRank meanwhile found that the global demand for Javascript outweighs the expertise available on the market

Before I get into the specifics, let’s go over some background information-

Javascript is a general-purpose scripting language that follows the ECMA scripting standards. So, what exactly is ECMA?

ECMA International is a technology standards organization. They’ve been in business since 1961. ECMA 262, also known as ECMAscript, is a standard published by ECMA International.

It defines a scripting language for general use. The ECMAscript standard specifies the rules and guidelines that must be followed by a script.

Now that we’ve established that, let’s look at how Javascript actually works.

Javascript is a client-term side scripting language.

The term ‘client-side’ scripting language refers to the fact that it runs at the client-side (or on the client’s machine) inside web-browsers, but it is important to note that the client’s web-browser must also support JavaScript or be JavaScript enabled.

Most modern web browsers now support JavaScript and have their own JavaScript engines. Google Chrome, for example, has its own JavaScript engine called V8.

As previously stated, most web browsers now have their own JavaScript engines. As a result, it is the JavaScript engine that understands and executes the code.

JavaScript is an interpreted language, which means it is executed line by line (or which means the JavaScript engine converts the Js code line by line and runs in the same manner instead of converting the whole program once).

We can understand how a typical JavaScript engine works with help of a diagram:

When we run a JavaScript program in a web browser, the browser’s engine receives the JavaScript code and executes the source code to produce the output.

The source code in a standard JavaScript engine goes through several steps before being executed, as shown in the diagram above.

Let’s take a closer look at each of these steps.

Step 1: Create a parser

This is the engine’s first stage; whenever we run a JavaScript program, our code is first received by the “parser” within the JS engine.

Because JavaScript is an interpretive scripting language, the parser’s job is to check the JavaScript code for syntactic errors in a line-by-line fashion.

Because JavaScript is an interpretive scripting language, the parser’s job is to check the JavaScript code for syntactic errors line by line.

When an error is detected, the parser throws an error and stops the execution of the code.

In short, we can say that it parses JavaScript code.

Step 2: AST

Once the parser checks all JavaScript codes and gets satisfied that there are no mistakes/errors in the code, it creates the data structure called AST (it stands for Abstract Syntax Tree).

Step 3: Coversion to machine code

Once the Abstract Syntax Tree is created by the parser, the JavaScript engine converts the JavaScript code into the machine code (or in the language that machine can understand).

Step 4: Machine code

When the program written in the JavaScript gets converted in the machine language (or in byte code), the converted code is sent to the system for execution, and finally, that byte code run by the system/engine just like we observe in our first example.

FEATURES OF JAVASCRIPT

The language has several features that distinguish it from others, including, but not limited to–

Scripting Language.

JavaScript is a lightweight scripting language designed for browser client-side execution. The set of libraries is also geared primarily towards web applications because it is not designed as a general-purpose language and is specifically engineered for web applications.

Based on an Interpreter

JavaScript is an interpreted rather than compiled language. In that regard, it is similar to languages such as Ruby and Python. The browser runs JavaScript by interpreting its source code line by line. A compiled language, on the other hand, must be compiled into a byte-code code executable. Compilable languages include Java and C++.

Event Management

An event is a system action or occurrence that communicates about itself so that you can respond to it in some way. For example, if a user clicks a button, the system instructs you to respond to the button click event with an action, such as displaying an information box. An example of this is below:

$(function() {
menu = $('nav ul')
$('#openup').on('click', function(e) {
e.preventDefault(); menu.slideToggle();
});

JavaScript allows you to handle events and even create your own.

Low weight

Because JavaScript is not a compiled language, it is not converted to byte-code beforehand. It does, however, adhere to the Just-In-Time (JIT) Compilation paradigm. That is, it is converted to bytecode just before running. As a result, JS can be lightweight. JavaScript can be run on even the most basic of devices.

Case Specific

JavaScript is case-sensitive. All keywords, variables, function names, and other identifiers can and must use consistent letter capitalization. In most cases, camelcase is used effectively in declaration. E.g.:

var shopCart = x
var shopcart=x

Variables are used here. Because of the case difference, shopCart and shopcart are both distinct variables. Furthermore, all keywords, including “var,” are case sensitive.

Statements of Control

JavaScript includes control statements such as if-else-if, switch-case, and loops such as for, while, and do-while loops. Because of these control statements, it is a powerful programming language that allows its user to write complex logic. An xample is shown thus —

if (hour < 18) {
greeting = "Good day";
} else {
greeting = "Good evening";
}

The history, foundation, and features of this language has contributed to its popularity, as the language has an active developer community that adds to its growth. Also, the creation of libraries and frameworks have made its application more efficient.

If you enjoyed this, give this 50 claps as a way of appreciation. Also leave a comment, share this post with your homies and follow me.

--

--

Ebubechukwu Ezike

Teaching as I learn. I make CSS easy for beginner frontend developers and product designers.