How does JavaScript work

Kavindu Chethani
SLIIT Women In FOSS Community
2 min readApr 26, 2023

One of the most effective and widely used scripting languages is JavaScript, a client-side language. The phrase “client-side scripting language” refers to the fact that it executes client-side (or on the client machine) within web browsers. However, it’s crucial to keep in mind that the client’s web browser must also support JavaScript or have JavaScript enabled. Nowadays, the majority of contemporary web browsers have JavaScript engines and support them. For instance, Google Chrome’s V8 JavaScript engine is it is own.

ex:- Google Chrome — v8, Firefox — Spider Monkey and Microsoft Edge-Chakra

Because JavaScript may be used for a variety of purposes in web development, it entirely depends on the web developers how and for what they utilize it. Validating user-provided input in form fields is one of JavaScript’s most popular applications.

In above image display how Java script works on a web page. A Document Object Model (DOM) is made from the contents of a web page by the web browser after it has loaded it, parsed the HTML, and rendered the page. Your JavaScript code is given a live view of the web page through the DOM.

The browser will then download all files that are connected to the HTML, including CSS and picture files. The CSS parser is where the CSS data is found.

The DOM initially assembles the HTML and CSS to build the web page. The JavaScript engine of the browser then loads inline code and JavaScript files but does not instantly execute the code. It holds off until the HTML and CSS have fully loaded.

In the above program, we simply displayed an alert message to the user by using the “alert()” method, which is a pre-defined method of JavaScript. We also used the “console.log();” method and passed “JavaScript” as the String, and in the inspect mode, we can see “JavaScript” in the console as shown in the below output.

As we have already covered, the majority of modern web browsers come equipped with their own JavaScript engines, which are responsible for understanding and executing the code.

In this article, I’m going through about how JavaScript works. If you guys find this article useful, share it with your friends. Thank you.

--

--

SLIIT Women In FOSS Community
SLIIT Women In FOSS Community

Published in SLIIT Women In FOSS Community

Empowering the potential and the contribution of women towards Free and Open Source software (FOSS).

Kavindu Chethani
Kavindu Chethani

Written by Kavindu Chethani

IT undergraduate | DEV enthusiastic