agyanadda@gmail.com

JS Introduction

JavaScript Basics 1 min read Updated Dec 1, 2026 Topic 1 of 38

JavaScript (JS) is the programming language of the web. HTML builds the page, CSS styles it and JavaScript makes it do things.

What can JavaScript do?

  • Change text, images and styles on the page
  • React to clicks, typing and scrolling
  • Check form data before it is sent
  • Load data from a server without reloading the page
  • Build games, apps and even servers (with Node.js)

How does it run?

Every browser has a JavaScript engine. When the page loads, the browser reads your script and runs it line by line.

JavaScript is not Java

The names are similar, but they are completely different languages.

Example

Example — Change text with a click HTML
<h2 id="msg">Hello!</h2>
<button onclick="document.getElementById('msg').textContent = 'You clicked the button!'">Click me</button>

JavaScript finds the heading by its id and changes its text.

Try it Now »

Test Yourself With Exercises

Exercise 1 Multiple Choice

Which language makes a web page interactive?

Exercise 2 True / False

JavaScript and Java are the same language.

Exercise 3 Fill in the Blank

JavaScript code is placed inside the HTML ___ tag.

Frequently Asked Questions

No. Every browser can run JavaScript. You can also use the AgyanAdda Try it editor online.