0% found this document useful (0 votes)
6 views

Java Script

The document discusses different JavaScript concepts like data types, variables, operators, control statements, functions, arrays, objects and more. It provides details on syntax and usage of concepts like let, var, const, loops, functions, arrays, objects, type conversion and string functions. The document is a comprehensive reference on core JavaScript concepts.

Uploaded by

Ankush Thakur
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Java Script

The document discusses different JavaScript concepts like data types, variables, operators, control statements, functions, arrays, objects and more. It provides details on syntax and usage of concepts like let, var, const, loops, functions, arrays, objects, type conversion and string functions. The document is a comprehensive reference on core JavaScript concepts.

Uploaded by

Ankush Thakur
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

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 Statementsfor, 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 casemyName(function or variable
name) Alert alert(“I am here”);

Pascal caseMyName(classes name) Promptsame as alert but with text box used for user
i/p….always returns in string
Snake casemy_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

replacereplace element from array

substringgives 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
DefinitionFunction myFunction(){ <func-body> }

CallingmyFunction();

Variables defined in function cannot be accessible outside the


function block

Parameters & arguments

arrow function()=> { }

var a=(a,b)=>{ return a+b;

IIFYImmediately invoked function

Call-back functions…js14

DE Structuring..js15
Array de-structuring [ ]

Rest operatorcollect ele and make it array

Spread operatorremove ele of array

Object de-structuring…js16{ }

You might also like