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

JavaScript Basics Notes

Uploaded by

SELVAMANI V
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)
2 views2 pages

JavaScript Basics Notes

Uploaded by

SELVAMANI V
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

JavaScript Basics

What is JavaScript?
JavaScript is a programming language used to create interactive web pages.

Variables
Use let, const, and var.
Example: let name='John'; const pi=3.14;

Data Types
String, Number, Boolean, Null, Undefined, Object, Array.

Operators
+ - * / %, ==, ===, !=, >, <, &&, ||

Conditions
if, else if, else, switch.

Loops
for, while, do...while, for...of.

Functions
function add(a,b){ return a+b; }

Arrays
let arr=[1,2,3]; [Link](4);

Objects
let user={name:'Sam',age:25};

DOM
[Link]('id').innerHTML='Hello';

Events
onclick, onchange, addEventListener().

Promises
new Promise((resolve,reject)=>{}); resolve/reject handle async tasks.

Async/Await
async function f(){ const r=await fetch(url);}
Fetch API
fetch(url).then(r=>[Link]())

Practice
Build a calculator, to-do list, form validation.

You might also like