1)What is javascript:-->Javascript is the most popular programming language
Javascript is programming language for web
2)What javascript can do:-->
a)It can change and update both html and css
b)it can calculate,manipulate and validate data
3)why to use javascript:-->Javascript is one of the 3 langauge that all web
developer should learn
a)HTML:-->define the content of web page
b)CSS:-->specify the layout of web page
c)Javascript:-->to program the behavior of web page
4)Javascript Variables:-->Javascript variables can be declared in 3 ways
a)var:-->this was used in all javascript codes from 1995 to 2015(not supported by
new browers only older versions of browsers)
b)let:-->this was added to javascript in 2015
c)const:-->this was added to javascript in 2015
5)When to use let,const and var
a)Always use const if the value should not be changed
b)Always use const if the type should not be changed(Array,object)
c)Use let if cant use const
d)Only use var if want to support old browsers
6)rules for declaring variables:-->
a)name can contain letter,digits,underscores and dollar signs
b)names must start with a letter
c)names can also begin with $ and _ (but should not use)
d)name are case sensitive (a and A both are different variables)
e)Reserved words like javascript keywords can not be used as variable name
7)Javascript operators:-->
a)Assignment Operator:-->= asign the value
b)Addition operator:-->+ adds the values
c)Multiplication operator:-->* multiplies the value
d)Comparison operator:--> > < compares the values
8)Datatypes:-->
a)string:-->a string is a series of characters
b)number:-->all javascript numbers are stored as decimal numbers
c)bigint:-->all javascript numbers a stored in 64 bit floating point format
d)boolean:-->Booleans have only two values true or false
e)undefined:-->in javascript a variable without a value known as undefined
f)null:-->it used to define null values
g)symbol:-->
h)object:-->javascript objects are written with curly braces{}
i)array:-->javascript arrays are written with square brackets[]
9)arrays:-->array is an object type designed for storing data collections
a)Element:-->An array is a list of values, these values known as elements
b)ordered:-->Array elements are ordered based on their index
c)Zero Index:-->The first element is at 0,the second at index 1
d)Dynamic size:-->Arrays can grow or shrink as elements are added or removed
10)Why to use arrays:-->to store multiple values in a single variable
const array_name = [element1,element2,...];
11)conditions:-->conditional statements are used to perform different actions based
on different conditions
a)if condition:-->to specify a block of code will be executed if a condition is
true
b)else condition:-->to specify a block of code will be executed if the same
candition is false
c)else if condition:-->to specify a new condition if the first condition is false
d)switch:-->to specify many alternative conditions
12)JS Loops:-->Loops can execute a block of code a number of times
a)for Loop:-->loops through block of code number of times
for(expression1,expression2,expression3){
code to execute
}
b)for in loop:-->loops through the properties of an object
for(key in object){
code will be executed
}
c)for of loop:-->loops through the value of iterable object
**iterable object:-->an object that have iterable properties(the values that
enumerable in for in loop)
for(variable of iterable){
code will executed
}
d)while loop:-->loops through a block of code as a specified condition is true;
while(condition){
code will be executed
13)Javascript Events:-->
a)onclick:-->when user clicks on html element
b)onchange:-->an html element or element value is chnaged
c)onmouseover:-->when user moves mouse on html element
d)onmouseout:-->when user removes mouse from html element
e)onkeydown:-->the user pushes a keybord key