What is JavaScript
JavaScript is a type of programming language: basically, a way to give instructions that a computer can understand. It’s used to make websites interactive.
When you click a button, fill out a form, or see part of a page update without reloading, that’s usually JavaScript at work. While HTML creates the basic structure of a webpage and CSS makes it look nice, JavaScript adds the “action.” It’s what makes websites responsive, allowing them to change based on what you do.
Examples
|
Code snippet |
What it does |
|
alert(“Hello, world!”); |
Displays a pop-up message in the browser |
|
document.getElementById(“title”).textContent = “Updated!”; |
Changes the text of an element with the ID “title” |
|
if (loggedIn) { showDashboard(); } |
Runs a function if the user is logged in |
|
const items = [“apple”, “banana”, “cherry”]; |
Creates an array of three items |
A brief history
JavaScript was created by Brendan Eich in 1995. It was originally developed in just 10 days and was first called Mocha, then LiveScript, and finally JavaScript.
At first, it was a simple scripting tool used to add basic interactivity to web pages. But over time, it has grown into a powerful programming language used for everything from building user interfaces to running backend servers.
Today’s JavaScript (especially versions from ES6 onward) includes advanced features like classes, modules, promises, and async/await, making it a core technology in modern web and software development.
Good to know
Despite the name, JavaScript is not related to Java. JavaScript is supported in every major web browser and doesn’t require any installation to run in the browser. It can interact with HTML and CSS through the Document Object Model (DOM), which lets developers change what’s shown on a page without reloading it.
Know more