What is JavaScript ?
JavaScript is a high-level, interpreted programming language that allows you to make web pages interactive and dynamic. Alongside HTML and CSS, it is one of the core technologies of web development.
- HTML → Builds the structure of a webpage (headings, paragraphs, buttons).
- CSS → Adds style and design (colors, fonts, layouts).
- JavaScript → Adds behavior and interactivity (clicks, animations, live updates).
Who Created JavaScript?
-
JavaScript was created by Brendan Eich in 1995 at Netscape Communications Corporation.
- Initially called Mocha, then LiveScript, and finally JavaScript.
- Remarkably, it was developed in just 10 days!
Why Use JavaScript?
JavaScript is used for:
- Interactive Web Pages – Respond to user actions like clicks, hover, or form submissions.
- DOM Manipulation – Dynamically change HTML content or CSS styles.
- Web Applications – Build apps like Gmail, Facebook, or e-commerce websites.
- Server-Side Development – Use Node.js for backend tasks like APIs and databases.
- Games and Animations – Create browser games and animations.
- Event Handling – React to keyboard, mouse, or page events.
Example:
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<h1 id="greeting">Hello!</h1>
<button onclick="changeText()">Click Me</button>
<script>
// JavaScript function to change text dynamically
function changeText() {
document.getElementById('greeting').innerText = "Hello, JavaScript!";
}
</script>
</body>
</html>