JavaScript ECMA2024 Presentation Content
JavaScript ECMA2024 Presentation Content
The DOM is a programming interface for HTML and XML documents. It represents the page
so that programs can change the document structure, style, and content dynamically.
It allows JavaScript to interact with and manipulate the web page. You can update content,
add or remove elements, change styles, and respond to user actions — all without reloading
the page.
Example:
document.getElementById("welcome").innerHTML = "Welcome to My Website!";
2. JavaScript Interactivity
JavaScript interactivity allows users to interact with a website — like clicking a button or
filling a form.
Example:
document.getElementById("btn").addEventListener("click", function() {
alert("Button was clicked!");
});
JSON (JavaScript Object Notation) is a lightweight format used for storing and exchanging
data.
Syntax Example:
{
"name": "Amit",
"age": 25,
"skills": ["JavaScript", "Python", "HTML"]
}
Classes provide cleaner syntax for OOP. Inheritance allows one class to reuse code from
another.
Example:
class Animal {
speak() {
console.log("Animal speaks");
}
}
class Dog extends Animal {
bark() {
console.log("Dog barks");
}
}
6. JavaScript Selectors
Examples:
document.getElementById("id")
document.querySelector(".class")
Importing in main.js:
import { add } from './math.js';
Example:
for (let color of colors) {
console.log(color);
}
9. Real-World Example
HTML:
<button id="greetBtn">Greet</button>
<p id="output"></p>
JavaScript:
class Greeter {
constructor(name) { this.name = name; }
greet() { return `Hello, ${this.name}!`; }
}
document.getElementById("greetBtn").addEventListener("click", () => {
let greeter = new Greeter("Student");
document.getElementById("output").innerText = greeter.greet();
});
10. Resources
- W3Schools: https://www.w3schools.com/js/
- MDN Docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript
- JavaScript Info: https://javascript.info/
- ECMA Specification: https://tc39.es/ecma262/