What is JavaScript?
JavaScript is a programming language that enables you to create dynamically updating content, control multimedia, animate images, and much more.
JavaScript is the programming language of the Web and runs in your browser.
Example
// JavaScript Syntax
console.log('Hello, World!');
// Variables
let name = 'John';
const age = 25;
// Function
function greet() {
alert('Hello!');
} Try JavaScript
HTML
<h1 id="demo">JavaScript Demo</h1>
<button onclick="changeText()">Click Me</button> CSS
button { padding: 10px 20px; background: #d1039e; color: white; border: none; border-radius: 5px; cursor: pointer; } JavaScript
function changeText() {
document.getElementById('demo').innerHTML = 'Text Changed!';
document.getElementById('demo').style.color = '#d1039e';
} Notes
- JavaScript adds interactivity and dynamic behavior to your websites.
