Professional Documents
Culture Documents
WBDV111 Finals CS2
WBDV111 Finals CS2
WBDV111 Finals CS2
Reduces
web loading time
➔ Allows to work with html and js files parallelly
and separately
JAVASCRIPT ➔ Length of code reduces
* Multiplication
JAVASCRIPT IF-ELSE
/ Division
➔ Used to execute the code whether the
% Modulo (Remainder)
condition is true or false
++ Increment (+1)
1. IF statement
-- Decrement (-1) - Evaluates the content only if
expression is true
2. COMPARISON OPERATORS:
2. IF ELSE statement
Operator Description Example - Evaluates the content whether the
expression is true or false
== Is equal to 10==20 = false
3. IF ELSE IF statement
=== Identical (equal and of 10==20 = false
- Evaluates the content only if
same type)
expression is true from several
!= Not equal to 10!=20 = true expressions
3. LOGICAL OPERATORS:
Operator Description Example
JAVASCRIPT SWITCH
&& Logical AND (10==20 && 20==33) = false ➔ Used to execute one code from multiple
expressions
|| Logical OR (10==20 || 20==33) = false ➔ Same as else if statement, but more
convenient that if else if statement
! Logical Not !(10==20) = true
4. ARITHMETIC OPERATORS:
= Assign 10+10 = 20
➔ Used to iterate the piece of code ➔ Default object of the browser is window,
➔ Makes the code compact representing the browser's window.
➔ Mostly used in arrays
1. FOR Loop
- Iterates for a fixed number of times
- Should be used if number of iteration
is known
2. WHILE Loop
- Iterated for a infinite number of times
- Should be used if number of iteration NOTE:
is unknown - Window is a browser’s object, while javascript’s
objects are string, array, date, etc.
HISTORY OBJECT
JAVASCRIPT FUNCTIONS
➔ Represents an array of URLs visited by the
➔ Used to perform operation user
➔ Can be called numerous of time to reuse
PROPERTIES OF WINDOW OBJECT:
Advantages of JavaScript Functions:
1. Reusability Property Description
2. Less Coding
Length Returns length of the history URLs
getElementByClassName(
getElementById()
getElementByName()