JAVA SCRIPT CONTROL STATEMENTS…js5, js7
Data Types::number, string, Boolean, null, undefined, Conditional statements if, if-else, if…else-if…else,
symbol, bigint(123n) switch
Let, var, const While let and const are block-scoped, var declarations are Looping Statementsfor, while, do-while
either globally scoped or function-scoped. Let variables can be updated but not re-
declared, const variables cannot be updated or re-declared, and var variables may for-in loop for(var i in firstaname)
both be updated and re-declared inside their scope.
Falsey value 0, null, undefine, false……all other value than this
are truly values
FUNCTIONS
To define any variable we use keyword var
Console.log print function
Notation:: camel casemyName(function or variable
name) Alert alert(“I am here”);
Pascal caseMyName(classes name) Promptsame as alert but with text box used for user
i/p….always returns in string
Snake casemy_name
TYPE CONVERSION FUNCTION..js9
Operators::unary, Binary, Ternary operator
Number(), String(),Boolean()
Arithmetic +, -, *, /, %, **, ++, --, a++ postfix; --a
prefix STRING…js10
Assignment =, +=, -=, *=, /=, %=, **= Type coercion when js interpreter implicit converts a value to
one type to another internally
Logical &&, ||, !
Strings are immutable
indexOf() gives the index number of string character
length()gives length i.e., no. of characters in a string..Property
charAt(<indexno.>)gives character of particular index
concat() performs concatenation
Comparison >, <, >=, <=, ==(loose equality; ignores substring() give specific character asked for
that data type), ===(tight equality; checks the
datatype),!=,!==(true) toUpper() converts into capital letters
toLower() converts into all small letter
Bitwise
template litrals${}
ARRAY..js11
Collection of dissimilar elements, resizable, mutable, it’s a
object too
push()adds element in array
pop() delete element from array
replacereplace element from array
substringgives specific elements from array
trim()used to remove blank spaces::trimStart()removes
spaces from left side::trimEnd()removes space from right side
multidimensional array var arr=[[1,2,3],[4,5,6],[7,8,9]]
OBJECT…js12
Var obj={ “key1”:”Value”, Key2”:”Value” }
Accessing element from object
Nested Object
FUNCTION..js13
DefinitionFunction myFunction(){ <func-body> }
CallingmyFunction();
Variables defined in function cannot be accessible outside the
function block
Parameters & arguments
arrow function()=> { }
var a=(a,b)=>{ return a+b;
IIFYImmediately invoked function
Call-back functions…js14
DE Structuring..js15
Array de-structuring [ ]
Rest operatorcollect ele and make it array
Spread operatorremove ele of array
Object de-structuring…js16{ }