0% found this document useful (0 votes)
2 views

JS Notes

JavaScript is a high-level, interpreted programming language used for creating interactive web pages, responding to user actions. It includes features like variable declaration (var, let, const), various function definitions (declarations, expressions, arrow functions), and DOM manipulation to dynamically alter web content. Additionally, JavaScript supports asynchronous programming through callbacks, promises, and the async/await syntax for handling operations that may not complete immediately.

Uploaded by

Mohd
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

JS Notes

JavaScript is a high-level, interpreted programming language used for creating interactive web pages, responding to user actions. It includes features like variable declaration (var, let, const), various function definitions (declarations, expressions, arrow functions), and DOM manipulation to dynamically alter web content. Additionally, JavaScript supports asynchronous programming through callbacks, promises, and the async/await syntax for handling operations that may not complete immediately.

Uploaded by

Mohd
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

JavaScript (Notes)

1. Introduction to JavaScript:
 JavaScript is a high-level, interpreted programming language that runs in
the browser and enables interactive web pages.
 JavaScript is event-driven, meaning it responds to user actions like clicks,
form submissions, etc.
2. JavaScript Basics:
 Variables: JavaScript uses var, let, and const to declare variables.
o let and const are block-scoped, while var is function-scoped.

let age = 25;


const name = "John";
3. Functions:
 Functions in JavaScript can be defined in several ways: function
declarations, expressions, and arrow functions.
function greet() {
console.log("Hello, World!");
}
 Arrow Functions: Shorter syntax for functions.
const greet = () => console.log("Hello, World!");
4. DOM Manipulation:
 The DOM (Document Object Model) represents the structure of the web
page.
 JavaScript can change the content, structure, and style of HTML elements
on the page dynamically.
document.getElementById("demo").innerHTML = "Changed content";
5. Asynchronous Programming:
 Callbacks: Functions passed as arguments to be executed later.
 Promises: Represent values that may not yet be available.
let promise = new Promise((resolve, reject) => {
resolve("Success!");
});
 Async/Await: Simplified syntax for working with asynchronous code.
async function fetchData() {
let response = await fetch('url');
let data = await response.json();
console.log(data);
}

You might also like