[go: up one dir, main page]

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

22BCY10150 JavaScript Summary

JavaScript is a high-level, interpreted programming language essential for web development, enabling dynamic content and interactivity in web applications. Key features include being lightweight, event-driven, and supporting asynchronous programming, along with various data types and variable declarations. It also allows for DOM manipulation and event handling, making it a versatile tool for developers.

Uploaded by

SUMANT SAGAR
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)
13 views2 pages

22BCY10150 JavaScript Summary

JavaScript is a high-level, interpreted programming language essential for web development, enabling dynamic content and interactivity in web applications. Key features include being lightweight, event-driven, and supporting asynchronous programming, along with various data types and variable declarations. It also allows for DOM manipulation and event handling, making it a versatile tool for developers.

Uploaded by

SUMANT SAGAR
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

JavaScript Summary

Introduction
JavaScript is a high-level, interpreted programming language primarily used for web
development. It enables dynamic content, interactivity, and client-side functionality in web
applications. It is supported by all modern web browsers and can be used alongside HTML
and CSS.

Key Features
1. Interpreted Language - Runs directly in the browser without compilation.
2. Lightweight - Designed for efficiency and speed.
3. Event-Driven - Executes code in response to user interactions.
4. Object-Oriented - Supports objects, prototypes, and classes.
5. Asynchronous - Uses callbacks, promises, and async/await for non-blocking operations.

Data Types
JavaScript has the following primitive data types:
- String
- Number
- Boolean
- Undefined
- Null
- Symbol
- BigInt

Variables
JavaScript uses `var`, `let`, and `const` to declare variables. Use `let` for block-scoped
variables and `const` for constants.

Functions
Functions in JavaScript can be defined using function expressions, function declarations,
and arrow functions.
Example:

```javascript
function add(a, b) {
return a + b;
}
```
Objects & Arrays
JavaScript supports objects and arrays for data storage and manipulation. Objects are key-
value pairs, while arrays are ordered lists.
Example:

```javascript
let person = {name: 'John', age: 30};
let numbers = [1, 2, 3, 4, 5];
```

DOM Manipulation
The Document Object Model (DOM) allows JavaScript to interact with HTML elements
dynamically.
Example:

```javascript
document.getElementById('demo').innerText = 'Hello, JavaScript!';
```

Event Handling
JavaScript handles user interactions using event listeners.
Example:

```javascript
document.getElementById('btn').addEventListener('click', function() {
alert('Button clicked!');
});
```

Asynchronous JavaScript
JavaScript supports asynchronous programming using:
- Callbacks
- Promises
- Async/Await

Example of a Promise:

```javascript
let promise = new Promise((resolve, reject) => {
setTimeout(() => resolve('Done!'), 1000);
});
promise.then(alert);
```

You might also like