
The core idea
JavaScript is a programming language commonly used to add behavior to web pages. Browsers execute JavaScript to respond to user actions, update the page, and communicate with web services.
How it works
A JavaScript program works with values such as strings, numbers, booleans, arrays, objects, null, and undefined. Variables declared with const cannot be reassigned, while let is used when reassignment is needed.
Practical considerations
Functions group reusable instructions. They can accept parameters and return results. Small functions with clear names make programs easier to test and maintain.
A useful way to apply it
Control flow determines which instructions run. if and else handle decisions, while loops repeat work. Array methods such as map, filter, and reduce provide common ways to transform collections.
Keep learning
Start by writing small scripts in the browser developer console or in a local HTML file. Practise selecting an element, responding to a button click, and changing text on the page.
Frequently asked questions
Is JavaScript the same as Java?
No. JavaScript and Java are separate programming languages with different ecosystems and language designs.
Where does JavaScript run?
JavaScript runs in web browsers and in server-side runtimes such as Node.js and other compatible environments.
Should I use var, let, or const?
Prefer const by default, use let when reassignment is needed, and avoid var in modern code unless maintaining legacy projects.
Continue learning
Explore more topics in the MicroProgrammer library, or browse the JavaScript collection for related guides.