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

Javascript__1725655981

The document contains notes on JavaScript concepts including variable scope, shadowing, hoisting, and the execution phases of JavaScript code. It discusses the differences between 'var', 'let', and 'const', as well as array methods like map, filter, and reduce, and introduces the concepts of anonymous functions and object destructuring. Additionally, it explains the use of the spread and rest operators, along with the distinction between deep and shallow copies.

Uploaded by

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

Javascript__1725655981

The document contains notes on JavaScript concepts including variable scope, shadowing, hoisting, and the execution phases of JavaScript code. It discusses the differences between 'var', 'let', and 'const', as well as array methods like map, filter, and reduce, and introduces the concepts of anonymous functions and object destructuring. Additionally, it explains the use of the spread and rest operators, along with the distinction between deep and shallow copies.

Uploaded by

ShreyasKumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 58

04/09/2024, 10:36 Askify | View Notes

Javascript Notes

Notes by:
https://www.linkedin.com/in/ramanjot-singh-5b574422b/

00:59

scope is a certain region of a program where a defined variable exists


and can be recognized and beyond that it cannot be recognized so
there can be multiple types of scopes

02:12

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 1/58
04/09/2024, 10:36 Askify | View Notes

02:24

02:32

02:35

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 2/58
04/09/2024, 10:36 Askify | View Notes

this is called variable shadowing in ehich for that block where its
scope was limited temporairaly a changed tp "Hi"
03:28

Notes by:
https://www.linkedin.com/in/ramanjot-singh-5b574422b/

03:21

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 3/58
04/09/2024, 10:36 Askify | View Notes

while shadowing a variable it should not cross the boundary of scope


that is we can shadow where variable by using let but cannot do the
opposite so if we try to shadow let variable by var variable it will be
called illegal shadowing

04:09

04:26

we cannot redeclare a variable by using let and const but we can do


using var

04:59

05:06

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 4/58
04/09/2024, 10:36 Askify | View Notes

this is fine as it comes under shadowing

05:27

in const declaration we need to provide const some value while


declaring it so it cannot be declared without initializing it.

Notes by:
https://www.linkedin.com/in/ramanjot-singh-5b574422b/

06:27

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 5/58
04/09/2024, 10:36 Askify | View Notes

06:53

When we execute a js code there are two phases one is a creation


phase and the other is execution phase so in creation phase three
things happen first it creates a global or a window object so

07:14

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 6/58
04/09/2024, 10:36 Askify | View Notes

07:20

07:12

the second step is it setups a memory heap for storing variables and
function references that means it takes all of the variables and
functions and stores it inside of this window object and the third step
is that it initializes those functions and variable declarations with
undefined

Notes by:
https://www.linkedin.com/in/ramanjot-singh-5b574422b/
07:40

for the function declarations it takes the whole complete function


from here and stores it inside of our window object and this is the
exact reason why hosting occurs

07:58

07:59

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 7/58
04/09/2024, 10:36 Askify | View Notes

during the execution phase the javascript engine executes the code
line by line assigning the values to variables and executes the
function calls also for every new function created javascript engine
creates a new execution context .

08:44

javascript also uses something called call stack which is a


mechanism to keep track of all of the function calls

08:54

09:00

During the creation phase javascript engine moves your


variables and function declarations to the top of your code and
this is known as hosting.

09:40

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 8/58
04/09/2024, 10:36 Askify | View Notes

How javascript looks at it

09:52

10:32

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 9/58
04/09/2024, 10:36 Askify | View Notes

let helps to overcome the limitation of var which did not warned us
about the declaration earlier

Javascript Notes
Notes by:
https://www.linkedin.com/in/ramanjot-singh-5b574422b/

11:12

let and var are going to be hosted in the temporal deadzone.


temporal dead zone is the time between the declaration and the
initialization of let and const variables .

13:25

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 10/58
04/09/2024, 10:36 Askify | View Notes

13:49

temporal dead zone is the term to describe the state where variables
are in the scope but they are not yet declared .

02:19

this will do is it's going to take each element of this array (nums) and
multiply by 3 and it's going to return a completely new array inside .
num,i,arr ki jagah kuch bhi p[ass kar do but ye dhayan rakho ki num
hai voh jo nums mai iterate karega

02:37

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 11/58
04/09/2024, 10:36 Askify | View Notes

03:21

in short filter returns only those elements from the array which
fulfills the provided criteria.

04:15

reduce takes two arguments a callback function and an intial value


acc contins value of the previous com,puation and curr contains the
current value

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 12/58
04/09/2024, 10:36 Askify | View Notes

basical
06:37

reduce helps in reducing the value of array to a single array value


agar new array create karna chahte hai toh ham map ka use karenga
but agar ham existing mai hechange karna chahte hai toh ham for
each ka use karenga

16:17

2)

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 13/58
04/09/2024, 10:36 Askify | View Notes

16:33

the second difference is that you can chain stuff on map so i can say
dot and something we can let's say if we want to do dot filter and do
some operation inside of this filter .

16:48

Approach 1)

18:01

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 14/58
04/09/2024, 10:36 Askify | View Notes

Better approch using


18:36

19:56

Notes by:
https://www.linkedin.com/in/ramanjot-singh-5b574422b/

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 15/58
04/09/2024, 10:36 Askify | View Notes

21:34

22:35

these functions map ,filter and reduce allows chaining we can chain
other functions in front of these functions .

23:14

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 16/58
04/09/2024, 10:36 Askify | View Notes

24:42

25:46

01:03

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 17/58
04/09/2024, 10:36 Askify | View Notes

01:40

anonymous function is a function which has no name and this


anonymous function can be assigned to a variable or can be passed
as a callback .

01:51

03:33

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 18/58
04/09/2024, 10:36 Askify | View Notes

understand how powerful functions are in javascript that we can pass


them inside of another function just like a variable and we can also
manipulate and return them from that function so this is called first
class function .

03:45

04:56

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 19/58
04/09/2024, 10:36 Askify | View Notes

09:15

var use nahi karna bcoz uska block scope hota hai

11:27

hostling works differently in case of fuctions which means it doesnt


matter wwheather we are calling the fucrion before or after declering
Notes by:

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 20/58
04/09/2024, 10:36 Askify | View Notes

https://www.linkedin.com/in/ramanjot-singh-5b574422b/
14:29

we have a variable present in a scope we will not go and check the


global scope we will always refer to the current scope .

16:10

this is called spread operator

16:29

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 21/58
04/09/2024, 10:36 Askify | View Notes

16:14

here when we use this operator this is called rest operator ...nums

16:55

17:30

a=5
x=6
y=3
baki ...numbers mai hoga

hen we use rest operator or spread operator it should always be the


last one so just like this so what this will do is

18:37

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 22/58
04/09/2024, 10:36 Askify | View Notes

19:33

21:17

we cannot have the arguments key word inside the arrow function

23:10

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 23/58
04/09/2024, 10:36 Askify | View Notes

this inside the arrow function points to the global object where as
this inside normal function is pointing to the object use
08:43

in order to traverse in object we use for each loop

a[ andar string ] hona chahiye to access it


Notes by:
https://www.linkedin.com/in/ramanjot-singh-5b574422b/

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 24/58
04/09/2024, 10:36 Askify | View Notes

11:07

JSON.stringyfy ne object ko convert kar diya string mai

11:48

to convert back

14:52

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 25/58
04/09/2024, 10:36 Askify | View Notes

15:20

15:05

when we provide these two keys inside of this square bracket what
this will basically do is it's gonna only stringify level and health

18:54

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 26/58
04/09/2024, 10:36 Askify | View Notes

aise acess karna object mai sai usko kehte hai object destructuring

Notes by:
https://www.linkedin.com/in/ramanjot-singh-5b574422b/

21:07

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 27/58
04/09/2024, 10:36 Askify | View Notes

we are basically creatring a reference by doing this so any change


made to d or c will change hence output in this case is "hello"
Deep copy ka matlab koi reference na hona and shallow copy ka
matlab reference hona
28:13

ye kuch tarike the

11:31

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 28/58
04/09/2024, 10:36 Askify | View Notes

these are not part of javascript but they are ways we can use powers
of browser in js code
00:46

when the timer expiers it will go to the call stack by using the call
back queue bcoz it will not directly go to the call stack.

16:53

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 29/58
04/09/2024, 10:36 Askify | View Notes

17:23

the function of the event loop is to check the vallback queue and
whatever in it to the call stack and the call stack quickly executes
this call back function.

whenever we run a javascript code a global execution context is


created and pushed inside the call stack and the code is executed line
by line
20:06

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 30/58
04/09/2024, 10:36 Askify | View Notes

when it sees the console.log() the it call the web api method console
so print "Start"

20:23

Notes by:
https://www.linkedin.com/in/ramanjot-singh-5b574422b/

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 31/58
04/09/2024, 10:36 Askify | View Notes

22:07

In the web apis environment it registers the call back () mathod and
attach event click to it
22:43

as we do not have anything to to execute so this global execution


context is pop out of stack
23:29

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 32/58
04/09/2024, 10:36 Askify | View Notes

when any user click on the button the call back fuction is pushed
into the call back queue
and it waits over here for it turn to get executed .
The event loop has only one job to constantly moniter the call stack
and call back queue

34:20

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 33/58
04/09/2024, 10:36 Askify | View Notes

bcoz the microtask queue has the higher priority it gives chance to
the cbf fuction to get inside the call stack
35:08

36:03

ab last mai isme cbt ka bhi nikal liya


Task queue will only be given oppertunity once
microtask queue is completed

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 34/58
04/09/2024, 10:36 Askify | View Notes

Blocking the main stack of js is called blocking the main thread so


that is why we say is there is any heavy function that takes time we
should always use an asyn function

06:09

aise samjh ki now it is the responsibility of the

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 35/58
04/09/2024, 10:36 Askify | View Notes

createorder api to call procedd to payment

08:40

our program kept on growing horizontaly insetead of vartically call


back hell
Inversion of control means that we giving the control of our pogram
to other part of code which we are not aware of

07:14

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 36/58
04/09/2024, 10:36 Askify | View Notes

whenever const promise = createOrder(call) this line is executed .


This createOrder(call) api will return us a promise which is nothing
but a empty object and the program will go on executing after some
time this empty object will be filled with data automatically
whatever asyunc time it takes
Now what we will do is attach a call back fuction to this promise
object and once we have data tp this promise object the call back
fuction attached would automatically be called.So we will have
control of our program with us as we are not passing our code some
other unkown code.
Fetch returns us a promise.

20:56

24:34

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 37/58
04/09/2024, 10:36 Askify | View Notes

Notes by:
https://www.linkedin.com/in/ramanjot-singh-5b574422b/

29:55

this is called promise channing

31:18

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 38/58
04/09/2024, 10:36 Askify | View Notes

return add karna mat bhulna

05:22

jo createOrder promise pas karega usko create karne ke liye we use


this syntax this Promise() constructor takes a function which has
resolve and
reject are the functions given by javascript to build

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 39/58
04/09/2024, 10:36 Askify | View Notes

promises.

10:17

18:06

we should always use the catch statement to handle errors gracefully


promise ko resolve karne ke liye we use resolve() THIS

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 40/58
04/09/2024, 10:36 Askify | View Notes

25:56

WE return what we need to handle in the next level of the chain


while doing promise chaning

30:45

what ever errors are there before this catch will be handeled and
after the catch jo bhi then statemenet hai voh run ho jayngi

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 41/58
04/09/2024, 10:36 Askify | View Notes

we are attcahing a faliure call back function with catch in order to


handle error

02:12

this async function will always return a promise

02:59

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 42/58
04/09/2024, 10:36 Askify | View Notes

either we return a promise or if we return a value which is a non


promise value it will take this value wrap it inside a promise and
return this value

09:06

async and await combo is used to handle promises


bina uske kaise handle kara hmne
10:43

12:25

you will use the keyword await in front of a promise that has to be
resolved

12:42

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 43/58
04/09/2024, 10:36 Askify | View Notes

13:31

that await is a keyword that can only be used inside a async function
.

22:27

22:41

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 44/58
04/09/2024, 10:36 Askify | View Notes

22:26

our JavaScript program JS engine was waiting for promise to resolve


so JS engine when you use this async await and it will go to line 23
only when 22 has got its value isse pehla wale mai jab ham await
nahi use kar rahe the tab jaise js ki nature hai fast fats sab execute ho
gya tha nad phir 10s ke baad voh line execute hue the vaise hota.

26:38

after 10s both the promises are resolved

32:25

that JS engine was waiting is not true at all right it is basically it


looks like the JS engine is waiting but it is not true at all

44:28

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 45/58
04/09/2024, 10:36 Askify | View Notes

43:26

JavaScript is not working waiting my dear friends function energy


execution is suspended JavaScript has is doing its job right 10
seconds will be taken for promise to resolve if meanwhile somebody
is clicking onto the web page everything will work everything will
work as expected right call stack is something which can which can
not be blocked right that is why JavaScript is 44:07amazing it does not
let call stack to be blocked

54:37

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 46/58
04/09/2024, 10:36 Askify | View Notes

54:23

this fetch returns a response so the response objects come over here
once this response object is here then once this response object is
here then we will do a DOT Json to convert that response body into
Json and instead of u can also convert it into string also convert it
into text also there are different type of values but I know that this
API will return me a Json right so to get that Json to read that Json .

01:00:59

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 47/58
04/09/2024, 10:36 Askify | View Notes

aise ham error ko handle kar sakte hai or


catch mai likh dena jo bhi lage to handle error

01:02:13

ye hai traditional dusra tarika 2 handle error

01:03:08

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 48/58
04/09/2024, 10:36 Askify | View Notes

there is a async function you can use await inside this async
function right to handle promises right and these promises are
asynchronous

01:06:25

so basically you don't have to do a promise fetch dot then dot then
but then it is helpful when you are doing promise chaining it makes
sense when you write code right so this line will only be executed
once
This Keyword

04:05

this keyword in global space will always have the value of global
object

05:29

a lot of students lot of developers don't understand this but let me tell
you in case of browsers this global object is window that is why you
see window written over here this window

05:45

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 49/58
04/09/2024, 10:36 Askify | View Notes

12:36

14:54

14:39

if you will call it like this window dox then it is the calling object
this window object it is the same window object hope you

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 50/58
04/09/2024, 10:36 Askify | View Notes

understood this

31:08

it will take the value of global object because this is now inside a
global space

Notes by:
https://www.linkedin.com/in/ramanjot-singh-5b574422b/

31:23

32:28

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 51/58
04/09/2024, 10:36 Askify | View Notes

35:21

whenever you see an Arrow function the value of this this keyword
will be where this Arrow function is lexically enclosed

35:51

this is the enclosing lexical context

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 52/58
04/09/2024, 10:36 Askify | View Notes

36:29

this keyword will behave exactly like how it it would behave inside
the enclosing lexical context you know

36:44

09:55

10:41

fuction along with its lexical scope bundles to form a closure and
when a function is returned the whole closure is returned

05:35

3 seconds because promise.all will make all these three API calls in
parallel but it will wait for all of them to finish .

06:25

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 53/58
04/09/2024, 10:36 Askify | View Notes

08:56

09:39

. all will get rejected as soon as any any of these promises gets
rejected .

14:47

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 54/58
04/09/2024, 10:36 Askify | View Notes

the output will always be the output over here will always be an
array right of the same number of promises that you passed in right
so there there were three promises so this array will contain three
values.

15:16

18:28

20:28

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 55/58
04/09/2024, 10:36 Askify | View Notes

sabse teej wala agar fail ho jata hai then error will be thrown

Promise.any is a success seeking race and whenever it is successful


it will return the success

24:11

Notes by:
https://www.linkedin.com/in/ramanjot-singh-5b574422b/

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 56/58
04/09/2024, 10:36 Askify | View Notes

24:23

27:12

if all fails then it will send an array of aggregate errrs

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 57/58
04/09/2024, 10:36 Askify | View Notes

Remove Ads from pdf and websites

Pricing

Now you can use Askify in any websites

See How

https://askify.video/view/youtube?_source=youtube_extension&_action=download_pdf&_id=5412b623-cf22-488f-a25f-f5b63785eac1 58/58

You might also like