0% found this document useful (0 votes)
5 views2 pages

JavaScript Important Topics

The document outlines key JavaScript topics including variables, data types, operators, functions, conditional statements, loops, arrays, objects, DOM manipulation, events, and ES6+ features. Each topic is accompanied by code examples to illustrate their usage. This serves as a concise guide for understanding essential JavaScript concepts.

Uploaded by

mahatokhushi270
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

JavaScript Important Topics

The document outlines key JavaScript topics including variables, data types, operators, functions, conditional statements, loops, arrays, objects, DOM manipulation, events, and ES6+ features. Each topic is accompanied by code examples to illustrate their usage. This serves as a concise guide for understanding essential JavaScript concepts.

Uploaded by

mahatokhushi270
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Most Important JavaScript Topics with Examples

1. Variables & Data Types


let name = "Sumit";
const age = 25;
var city = "Delhi";

2. Operators
let a = 10;
let b = 5;
console.log(a + b); // Addition

3. Functions
function greet(name) {
return "Hello " + name;
}
console.log(greet("Sumit"));

4. Conditional Statements
let age = 18;
if (age >= 18) {
console.log("Adult");
} else {
console.log("Minor");
}

5. Loops
for (let i = 0; i < 5; i++) {
console.log(i);
}

6. Arrays & Array Methods


let nums = [1, 2, 3, 4];
let squared = nums.map(n => n * n);
console.log(squared);
7. Objects
let person = {
name: "Sumit",
age: 25,
greet: function() {
return "Hello " + this.name;
}
};
console.log(person.greet());

8. DOM Manipulation
document.getElementById("btn").addEventListener("click", () => {
alert("Button clicked!");
});

9. Events
document.querySelector("input").addEventListener("input", function(e) {
console.log("Input changed:", e.target.value);
});

10. ES6+ Features


const add = (a, b) => a + b;
console.log(add(2, 3)); // 5

You might also like