Please enable JavaScript.
Coggle requires JavaScript to display documents.
Java script - Coggle Diagram
Java script
Java script engine
Memory Heap
Where Memory allocation
EX : const a = 5; we strore it in memory heap
Memory leak
Causes
Limited amount of memory heap
Unused variable that fills the memory
Lot of global variables
Call stack
Execute our code line by line
Each time we encounter a function we stack it as as soon as it finishes or return something we remove it
So wehenever we make a CALL we STACK it to keep trace and order
Java script is single threaded it has only one CALL STACK
To make it simple and avoid multi threaded problems like DEADLOCKS
Ex :
X starts to use A.
X and Y try to start using B
Y 'wins' and gets B first
now Y needs to use A
A is locked by X, which is waiting for Y
So a function cannot be executed until the fonction before it finishes
Problem : BLOCKING
LongFunction();
shortFunction ();
Single threaded => that to execute the short function we must wait for the long function to finish so we are
blocking
our program .... the ideal would be to execute the short function when we call it
But java script is NON BLOCKING
Solution is ASYNCHRONOUS
1 more item...
We call executing line by line SYNCHROUNOUS PROGRAMMMING
Stack overflow
When the call stack reached and we want to exceed it limit
for exemple infinite recursive call
JS Run Time Envirenment
Componenent
JS Engine
Already explained go to js Engine
WEB APIs
DOM
It is the displayed page
The output of the HTML CSS in the page
We manipulate it with js
CALLED DOM MANIPULATION
EX:Selectors..
Ajax
TimeOUT
AND more
Call back Queue
Event Loop