Skip to main content

Menu

System onlineAI Tutorials / 2026

AI Tutorials
Knowledge search

Recent · Popular · Tutorials

  • dart3 tutorials
  • java1 tutorial
  • Javascript5 tutorials
  • Node.js Introduction2 tutorials
  • JavascriptJavascript · Beginner · Mid
  • JavascriptJavascript · Beginner · Short
  • dartdart · General · In depth
  • JavascriptJavascript · Advanced · In depth

Find a tutorial

Tell the assistant what you want to learn. It suggests published chapters.

For example: “I want to learn Rust ownership from the start.” The conversation is kept only in this tab.

0 / 2,000 characters

Enter to send, Shift+Enter for a new line. Do not include personal information.

Chapter 1

What JavaScript Is and Where It Runs

JavaScript is a programming language. A programming language is a set of instructions a computer can follow. You write the instructions as text, and the computer runs them one by one.
Level: BeginnerLength: Mid2 min read

Read at another depth

What JavaScript Is and Where It Runs

JavaScript is a programming language. A programming language is a set of instructions a computer can follow. You write the instructions as text, and the computer runs them one by one.

JavaScript was made in 1995 so web pages could do more than just sit still. With JavaScript, a page can react: it can show a message when you click a button, check a form before you submit it, or load new data without refreshing.

JavaScript is everywhere:

  • Browsers like Chrome, Firefox, and Safari run JavaScript on every web page.
  • Servers (computers that send out web pages) run JavaScript too, using a tool called Node.js.
  • Apps for phones and desktops can be built with it.

In this tutorial, we focus on JavaScript in the browser, because that is where most people meet it first.

How JavaScript Gets to the Page

A web page is written in HTML. HTML is a markup language: it describes the parts of a page, like headings, paragraphs, and buttons. HTML alone cannot react to the user. JavaScript adds that reaction.

You can put JavaScript in a page with a <script> tag. When the browser reads that tag, it starts running your code.

Code example in html
<!DOCTYPE html>
<html>
  <body>
    <h1>My Page</h1>
    <script>
      console.log('Hello from JavaScript!');
    </script>
  </body>
</html>

console.log is a command that prints a message. You can see these messages in your browser's developer console, a panel that shows what your code prints and any errors it hits. Open it in Chrome or Firefox by pressing F12 (or right-clicking the page and choosing "Inspect").

A flow diagram showing the browser loading HTML, reaching the script tag, running the JavaScript, and updating the page for the user.
100%
How a browser loads a page and runs its JavaScript
Show diagram source
flowchart LR
  A[Browser requests page] --> B[Browser reads HTML]
  B --> C{script tag found}
  C --> D[JavaScript code runs]
  D --> E[Page can react to the user]

What JavaScript Is Not

Two common confusions are worth clearing up now:

  • JavaScript is not Java. They sound alike, but Java is a different language made for different jobs. The similar name was a marketing choice in the 1990s.
  • JavaScript is not HTML. HTML describes what is on a page. JavaScript describes what the page does.

Why Learn It?

JavaScript is the only language every browser can run. That makes it essential for building anything interactive on the web. It is also forgiving for beginners: you can open the console and start typing right now, with no installs and no setup.

In the next chapter, you will write and run your very first JavaScript code in the browser console.

Exercise

What is the difference between HTML and JavaScript?

Show answer

HTML describes the structure and content of a page (its parts, like headings and buttons). JavaScript gives the page behavior, letting it react to clicks, input, and other events.

Exercise

Is JavaScript the same as Java?

Show answer

No. They are completely different languages. The similar names are historical, not technical.

Spotted a mistake, or code that does not work?

Report an issue

Chapter: What JavaScript Is and Where It Runs

0 / 2,000 characters

Plain text, for example: the second code sample does not compile. Do not include personal information.

You can't do that