What Is JavaScript
Introduction
JavaScript is a high-level, interpreted programming language built for interactive software on the web and beyond. This chapter explains what JavaScript is, where it runs, and why it matters in real engineering work. If you understand these basics, you can choose the right learning path—browser frontends, full-stack apps, or Node.js tooling—without confusion about names, runtimes, or standards.
Prerequisites
- No prior programming experience is required for this introduction
- A modern web browser (Chrome, Firefox, Safari, or Edge) is enough to try quick examples in DevTools
- For later chapters in this track, you will install Node.js LTS (the tutorials assume a current LTS release such as Node 22)
JavaScript Core Concepts
JavaScript is designed for fast iteration and user-facing behavior. You write source code in plain text files (usually .js), and a runtime executes that code—either inside a browser or on a server with Node.js.
Core characteristics:
- Interpreted execution: code runs through a JavaScript engine without a separate compile step for every change (though engines optimize heavily under the hood)
- Event-driven: much real-world JavaScript reacts to user clicks, network responses, timers, and messages
- Dynamic typing: variable types are determined at runtime, which speeds prototyping but requires discipline in larger codebases
- First-class functions: functions are values you can pass around, which powers callbacks, promises, and modern async patterns
- Multi-paradigm style: you can write procedural, object-oriented, and functional code in the same project
Two Main Runtimes: Browser and Node.js
The same language syntax can run in different environments. The APIs available in each environment are what change—not the core language rules taught in early chapters.
In the browser
Browsers ship a JavaScript engine (for example, V8 in Chrome, SpiderMonkey in Firefox). Browser JavaScript can:
- Update the page (DOM)
- Handle user events (clicks, keyboard input)
- Call web APIs (
fetch,localStorage, geolocation, and more)
Every major website you use daily relies on browser JavaScript for interactivity.
In Node.js
Node.js is a runtime that runs JavaScript outside the browser—on your laptop, in CI pipelines, or on cloud servers. Node.js is built on the same V8 engine used in Chrome, but it exposes system APIs (files, processes, networking) instead of DOM APIs.
Typical Node.js uses:
- REST and GraphQL APIs
- CLI tools and build scripts
- WebSocket and streaming services
- Automation in DevOps workflows
Tip
Same language, different APIs
console.log works in both browser DevTools and Node.js. document.querySelector exists only in the browser. fs.readFile exists only in Node.js. Learn the language first; learn environment APIs as you specialize.
Where JavaScript Is Used in Real Projects
JavaScript is not only for small homepage animations. It is a primary language for production systems worldwide.
Common engineering scenarios:
- Web frontends: build interfaces with React, Vue, Svelte, or Angular (frontend engineer, design systems and SPAs)
- Full-stack products: share language and types across client and server with Next.js, Nuxt, or Remix (full-stack engineer, SSR and APIs)
- Mobile and desktop: ship cross-platform apps with React Native or Electron (mobile/desktop teams, shared JS skillset)
- Backend services: APIs and microservices on Node.js with Express, Fastify, or NestJS (backend engineer, I/O-heavy services)
- Developer tooling: bundlers, linters, and test runners (Vite, ESLint, Jest) are often written in JavaScript (platform/tooling engineer)
In short, learning JavaScript can lead to frontend development, backend services, full-stack product work, or tooling—depending on which ecosystem you focus on.
ECMAScript and Modern JavaScript (ES6+)
ECMAScript (often shortened to ES) is the official specification behind JavaScript. Browser vendors and Node.js implement that standard; frameworks and libraries build on top of it.
Practical notes for this tutorial:
- When people say “modern JavaScript” or ES6+, they mean features from ES2015 onward:
let/const, arrow functions, classes, modules, promises, and more - Newer yearly releases add syntax and builtins (optional chaining
?., nullish coalescing??, top-levelawait, and others) - This series targets current LTS Node.js and evergreen browsers, so examples use modern syntax unless a concept specifically requires legacy style
You do not need to memorize every ECMA edition number. Focus on writing clear, standard code that runs on supported runtimes your team chooses.
Try JavaScript in One Minute
You can run JavaScript immediately in a browser console—no install step required for this quick check.
- Open your browser DevTools (often
F12orCmd+Option+Ion macOS) - Go to the Console tab
- Type the following and press Enter:
// Greet the learner and show today's date
const topic = "JavaScript";
console.log(`Welcome to ${topic}!`);
console.log("Today:", new Date().toLocaleDateString());You should see two lines of output. That is JavaScript executing in the browser runtime.
If you already have Node.js installed, save the same snippet as hello.js and run:
node hello.jsInstallation chapters later in this track cover Node.js setup in detail for Windows, macOS, and Linux.
FAQ
Is JavaScript the same as Java?
No. Despite similar names, they are different languages with different designs and ecosystems. Java is compiled to JVM bytecode and is common in enterprise backends and Android. JavaScript is interpreted in browsers and Node.js and is the standard language of the web. The naming history is confusing; the technologies are not interchangeable.
Is JavaScript only for websites?
No. Browser work is the most visible use case, but Node.js makes JavaScript a strong choice for APIs, CLIs, scripts, and real-time servers. Many engineers use JavaScript on both client and server in one product.
Is JavaScript a good first programming language?
Yes, especially if you want to build things you can see immediately in a browser. Start with fundamentals (variables, functions, control flow), then add frameworks once you understand how the language behaves.
Which JavaScript version should I learn?
Learn modern JavaScript (ES2015+) on a current Node.js LTS release and an evergreen browser. Avoid tutorials that teach only legacy patterns (var-only code, outdated module systems) unless you maintain old codebases.
Do I need a framework to start learning JavaScript?
No. Learn core language features first. Pick frameworks later based on your goals—React or Vue for UIs, Express or Fastify for APIs, and so on.
Do I need TypeScript?
Not on day one. TypeScript is JavaScript plus static types and is widely used in production frontends and Node.js services. This series starts with plain JavaScript so concepts stay clear; you can adopt TypeScript after you are comfortable with the basics.