JavaScript is a programming language that developers use to create interactive web pages. JavaScript features can enhance the user’s experience with a website, from updating social media news feeds to displaying animations and interactive maps. JavaScript is a programming language for developing scripts for client-side execution, making it one of the core technologies on the World Wide Web. For example, the image carousel, clickable drop-down menus, and dynamically changing colors of elements on a web page that you see while browsing the Internet are all made with JavaScript.

What is JavaScript used for?

Historically, web pages were static, similar to pages in a book. A static page basically displayed information in a fixed way and didn’t do everything we now expect from a modern website. The JavaScript language emerged as a browser-side technology to make web applications more dynamic. Using it, browsers could react to user interaction and rearrange content on a web page.

As the language evolved, JavaScript developers created libraries, frameworks, and programming practices and began using it outside of web browsers. Today, JavaScript can be used for both client-side and server-side development. In the following subsections, we provide some common use cases.

Historically, web pages were static, similar to pages in a book. A static page basically displayed information in a fixed way and didn’t do everything we now expect from a modern website. The JavaScript language emerged as a browser-side technology to make web applications more dynamic. Using it, browsers could react to user interaction and rearrange content on a web page.

As the language evolved, JavaScript developers created libraries, frameworks, and programming practices and began using it outside of web browsers. Today, JavaScript can be used for both client-side and server-side development. In the following subsections, we provide some common use cases.

How does JavaScript work?

All programming languages All programming languages work by translating English syntax into machine code, which is then executed by the operating system. JavaScript can broadly be categorized as a scripting or interpreted language. JavaScript code is interpreted, that is, directly translated into machine language code by the JavaScript engine. In other programming languages, the compiler processes all the code into machine language code in a separate step. Thus, all scripting languages are programming languages, but not all programming languages are scripting languages.

JavaScript engine

A JavaScript engine is a computer program that executes JavaScript code. The first JavaScript engines were just interpreters, but all modern engines use JIT compilation or runtime compilation to improve performance.

Client-side JavaScript

Client-side JavaScript refers to how JavaScript runs in your browser. In this case, the JavaScript engine is inside the browser code. All major web browsers have their own built-in JavaScript engines.

Web application developers write JavaScript code with different functions related to different events, such as mouse clicks or mouseovers. These functions make changes to HTML and CSS.