UNIT–3 : JavaScript Cheat Sheet (Definitions,
Basics & Syntax)
1. JavaScript
JavaScript is a client-side scripting language used to create dynamic and interactive web pages.
2. Function
A function is a block of code designed to perform a specific task.
Syntax:
function functionName() { statements; }
3. Switch Statement
Used to execute different blocks of code based on a condition.
Syntax:
switch(expression) { case value: statements; break; }
4. Prompt Box
Used to take input from the user.
Syntax: prompt("message");
5. Array
An array is used to store multiple values in a single variable.
Syntax:
var a = [1,2,3];
6. Array Methods
push() → add element
pop() → remove element
length → size of array
7. Fibonacci Series
A series where each number is sum of previous two numbers.
8. DOM
Document Object Model represents HTML as tree structure and allows dynamic manipulation.
Syntax:
[Link]("id");
9. Built-in Objects
String, Math, Date, Array, Number
10. String Methods
length, toUpperCase(), toLowerCase(), charAt(), replace()
11. Regular Expression
A pattern used for string matching and validation.
Syntax:
/^[0-9]{10}$/
12. Form Validation
Checking user input before submission using JavaScript.
13. JSON
JavaScript Object Notation used for storing and transferring data.
Syntax:
{ "key":"value" }
14. jQuery
A JavaScript library used to simplify DOM manipulation.
Syntax:
$(selector).action();
15. jQuery Selectors
$("p") → element
$("#id") → id
$(".class") → class
16. Event
An action performed by user like click, submit, load.