RadarTrek
Home/Courses/JavaScript/What Is JavaScript and Where Does It Run?
Lesson 01 / 11·6 minFree

What Is JavaScript and Where Does It Run?

The only language that runs natively in every browser — and now on servers too

JavaScript runs in two environments — browser and server 🌐 Browser (Frontend) Manipulates HTML/CSS Handles clicks and events Fetch data from APIs Local storage, cookies 🖥️ Node.js (Backend) Build web servers Read/write files Connect to databases npm packages Same language — different superpowers depending on where it runs

HTML is nouns. CSS is adjectives. JavaScript is verbs. It makes things happen — buttons respond to clicks, forms validate input, pages update without reloading. JavaScript is the language that makes the web feel like an application rather than a document.

The light switch analogy

💡

HTML/CSS is the room. JavaScript is the electricity.

You can have a beautifully decorated room (HTML + CSS) — but without electricity, nothing works. No lights, no appliances, no interactivity. JavaScript is the electricity. It powers all the dynamic behaviour: show this panel when that button is clicked, validate this email address, load more results when the user scrolls down.

Your first JavaScript

Adding JavaScript to an HTML page

<!-- Option 1: inline script tag (small amounts of JS) -->
<script>
  alert('Hello from JavaScript!')
  console.log('This appears in DevTools')
</script>

<!-- Option 2: external file (recommended for larger projects) -->
<script src="app.js" defer></script>

<!-- defer means: download the JS but don't run it until
     the HTML is fully parsed — avoids blocking the page load -->

The browser console — your JavaScript playground

Every browser has a built-in JavaScript console. Press F12 (or Cmd+Option+I on Mac), click Console, and type JavaScript directly. This is the fastest way to experiment.

Open the console and try these

1.

Open DevTools and go to the Console tab

F12 → Console

Result

You'll see a > prompt waiting for input
2.

Print a message

console.log("Hello JavaScript")

Result

Hello JavaScript
3.

Do some maths

2 + 2 * 5

Result

12 (multiplication happens before addition)
4.

Get today's date

new Date().toLocaleDateString()

Result

"05/06/2026" (or your local format)
5.

See a JavaScript error (on purpose)

undeclaredVariable

Result

ReferenceError: undeclaredVariable is not defined

Try this

Open the console on any website you use regularly. Type document.title in the console — it returns the page's title. Then type document.body.style.background = "red" and watch the background change. You just ran JavaScript on a live website.

RadarTrek Intel — monthly score updates

We track 40+ tools so you don't have to. Score changes, new tools, and new guides — once a month, no spam.