Javascript Notes
Javascript Notes
1. What is JavaScript?
JavaScript is a lightweight, interpreted programming language mainly used to make web
pages interactive. It runs on the client side (browser) and adds dynamic behavior like
animations, form validations, and pop-ups.
2. Features of JavaScript
- Lightweight and fast
- Interpreted language
- Dynamic typing
- Object-based
- Event-driven
- Cross-platform
3. Advantages of JavaScript
- Runs on the client-side
- Easy to learn
4. Disadvantages of JavaScript
- Code is visible to users (security risk)
5. What is a Script?
A script is a set of instructions written to perform a specific task. In web development, it
often refers to code written in a scripting language like JavaScript.
6. Types of Script
- Client-side Script: Runs in the browser (e.g., JavaScript)
var x = 5;
let y = "Hello";
const PI = 3.14;
Types:
- var: Function-scoped
- let: Block-scoped
Loops:
- for
- while
- do...while
- for...in (objects)
- for...of (arrays)