All about Mozilla’s JavaScript engine

Usecase of javascript in any of your favorite industries.

Rachana Jaiswal
5 min readJun 19, 2021

For most people using JavaScript, in a web page is the only place where they use it.JavaScript is the most advanced. It adds dynamic functionality to web pages, which make them much more interactive.

The HTML defines what the content is.The appearance of a web page is defined using Cascading Style Sheets that specify which media the specific commands apply to, so the content formats appropriately for the device.

Using just these two languages you can create static web pages that will be accessible regardless of which device is used to access the page. These static pages can interact with your visitor through the use of forms. After a form is filled out and submitted, a request is sent back to the server where a new static web page is constructed and eventually downloaded into the browser.

JavaScript translates your static page into one that can interact with your visitors without them needing to wait for a new page to load every time they make a request. No longer does your visitor need to fill out an entire form and submit it in order to be told that they made a typo in the first field and need to enter it all again.

Mozilla’s JavaScript

When Firefox loads a web page, it is likely that this web page will need to run some JavaScript code. This code is transferred to the browser from the network, from the network cache, or from a service worker.

JavaScript is a general purpose programming language that is used to improve web pages. It makes them more interactive, it can request dynamically loaded content, and it can improve the way web pages are programmed with libraries.

JavaScript libraries are collections of code that are quite wide in terms of scope and usage. Most of the code of these libraries is not used (~70%) while the web page is starting up. The web page’s startup lasts beyond the first paint, it goes beyond the point when all resources are loaded, and can even last a few seconds longer after the page feels ready to be used.

When all the bytes of one JavaScript source are received we run a syntax parser. The goal of the syntax parser is to raise JavaScript syntax errors as soon as possible. If the source is large enough, it is syntax parsed on a different thread to avoid blocking the rest of the web page.

As soon as we know that there are no syntax errors, we can start the execution by doing a full parse of the executed functions to generate bytecode. The bytecode is a format that simplifies the execution of the JavaScript code by an interpreter, and then by the Just-In-Time compilers (JITs). The bytecode is much larger than the source code, so Firefox only generates the bytecode of executed functions.

he JSBC aims at improving the startup of web pages by saving the bytecode of used functions in the network cache.

Saving the bytecode in the cache removes the need for the syntax-parser and replaces the full parser with a decoder. A decoder has the advantages of being smaller and faster than a parser. Therefore, when the cache is present and valid, we can run less code and use less memory to get the result of the full parser.

Applications of Javascript

Presentations

Server Applications

Manipulating HTML Pages

Back-end Data Loading

Client side validation

Common Uses of JavaScript

1. Websites

JavaScript lets you add behavior to the web page where the page responds to actions without loading a new page to request processing. It enables the website to interact with visitors and execute complex actions.

2. Web Applications

As browsers and personal computers have continued to improve, JavaScript gained the ability to create robust web applications. Consider applications like Google Maps. If you want to explore a map in Google Maps, all you have to do is click and drag with the mouse. You will see the part of the map that is less detailed and then fills itself in. That’s the work of JavaScript behind the scene.

3. Presentations

A very popular use of JavaScript is to create presentations as websites. Using the Reveal.js framework, this becomes really easy if you are familiar with HTML and CSS.

4. Server Applications

With the advent of Node.js a few years ago, JavaScript made its way from the browser into the server. Since then Node is adopted by major companies such as Wal-Mart, as a key part of back end infrastructure.

5. Web Servers

You can create much more robust servers using Node or the standard server application framework Express.js. Many of the previously mentioned Nodes are actually built using MEAN stack (Mongo Express Angular Node) of which Express is the key component.

6. Games

While the browser hasn’t been the traditional games platform in the past, recently it has become robust for games. Additionally, with the addition of HTML5 canvas, the level of complexity that is possible in the browser-based games has increased exponentially. There are even browser games that teach us programming.

7. Art

One of the new features of HTML5 specification is the canvas element, which allows the browser to render three-dimensional spaces. This helps to open the browser as a new source for digital art projects.

8. Smartwatch Apps

Popular smartwatch maker Pebble has created Pebble.js, a small JavaScript framework that allows a developer to create an application for the Pebble watches in JavaScript.

9. Mobile Apps

For example — Mobile devices are now the most popular way to access the internet. What this means is all of the websites should be responsive. The catch is that the mobile app comes in two major applications, Apple and Android. And those applications are written in completely different languages.

10. Flying Robots

Yes, you read that right. Several commercially available quadcopters, some outfitted with a simple OS, make it possible to install Node.js. This means that you can program a flying robot with JavaScript. JavaScript is the most accessible programming language on this planet, having many features. So, it’s good to see that it is creating such a wide range of applications.

  • - — — — — — Thank you for your valuable time- — — — -

--

--