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

JavaScript Notes

JavaScript is a scripting language that enables dynamic content on websites and runs in the browser. Key concepts include variables (var, let, const), data types (String, Number, Boolean, etc.), functions, conditions, loops, arrays, objects, events, and DOM manipulation. ES6 features such as arrow functions and template literals enhance JavaScript's capabilities.

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 views3 pages

JavaScript Notes

JavaScript is a scripting language that enables dynamic content on websites and runs in the browser. Key concepts include variables (var, let, const), data types (String, Number, Boolean, etc.), functions, conditions, loops, arrays, objects, events, and DOM manipulation. ES6 features such as arrow functions and template literals enhance JavaScript's capabilities.

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/ 3

JavaScript Notes

1. What is JavaScript?

- JavaScript is a scripting language used to create and control dynamic website content.

- It runs in the browser and allows interactive web pages.

2. Variables:

- var, let, const are used to declare variables.

Example:

let x = 10;

const y = 20;

3. Data Types:

- String, Number, Boolean, Object, Array, Null, Undefined

Example:

let name = "John";

let age = 25;

let isStudent = true;

4. Functions:

- Functions are blocks of code that perform a task.

Example:

function greet(name) {

return "Hello " + name;

5. Conditions:
- if, else if, else, switch

Example:

if (age > 18) {

console.log("Adult");

} else {

console.log("Minor");

6. Loops:

- for, while, do-while

Example:

for (let i = 0; i < 5; i++) {

console.log(i);

7. Arrays:

- Arrays hold multiple values.

Example:

let colors = ["red", "green", "blue"];

console.log(colors[0]); // red

8. Objects:

- Objects store key-value pairs.

Example:

let person = {name: "Alice", age: 30};

console.log(person.name);
9. Events:

- Used to handle user interactions.

Example:

<button onclick="alert('Clicked!')">Click Me</button>

10. DOM Manipulation:

- JavaScript can access and change HTML content.

Example:

document.getElementById("demo").innerHTML = "Hello!";

11. ES6 Features:

- Arrow functions, Template literals, Destructuring, Spread operator

Example:

const add = (a, b) => a + b;

You might also like