JavaScript is the world’s most popular programming language, used to make web pages interactive. Along with HTML and CSS, it forms the foundation of web development.
JavaScript Introduction
What is JavaScript?
- A lightweight, interpreted programming language.
- Runs inside browsers (client-side) and also on servers (Node.js).
- Used for dynamic content, form validation, animations, and full web apps.
Key Features of JavaScript
- Dynamic typing (no need to declare types explicitly).
- Prototype-based object system.
- First-class functions (can be stored, passed, returned).
- Event-driven and asynchronous programming support.
- Modern ES6+ features (arrow functions, classes, modules, promises).
First Example: Hello World
You can display output in multiple ways:
// 1) Alert box
<script>
alert('Hello World!');
</script>
// 2) Console log (DevTools)
<script>
console.log('Hello Console!');
</script>
// 3) Write into HTML
<div id="demo"></div>
<script>
document.getElementById('demo')
.innerHTML = 'Hello Page!';
</script>
Where Does JavaScript Run?
Originally built for browsers, JS now runs almost everywhere:
- Browser: Chrome, Firefox, Edge, Safari (via JavaScript engines like V8, SpiderMonkey)
- Server: Node.js (built on V8)
- Desktop & Mobile Apps: via frameworks like Electron, React Native
- IoT & More: JS engines embedded in devices
A Short History
- 1995 – Created by Brendan Eich at Netscape in just 10 days.
- 1997 – Standardized as ECMAScript (ES).
- 2009 – Node.js made JS run on servers.
- 2015 – ES6 (ECMAScript 2015) brought classes, modules, arrow functions, let/const.
- Today – Evolving yearly with new features.
Tip: Always practice in DevTools console (F12) to test small snippets quickly.