JAVASCRIPThjoydopwedsdsdsdsadddsadsdsad.pptx

AmrendraKumar572683 8 views 12 slides Oct 19, 2024
Slide 1
Slide 1 of 12
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12

About This Presentation

asfdasdcdsaddsdfdfsdfsdsdaa;'sac


Slide Content

JAVASCRIPT Date-02/02/2024

Functions , Synchronous and Asynchronous function

Overview Why Javascript Functions in Js single threaded nature of js Synchronous Function Asynchronous Function 01 02 03 04 06

since we all know our Browser understands only HTML, CSS and JS. Another reason is it can be used for the the client side development as well as server side development. Why Javascript

Functions in Js Function takes some input , do some logic and then returns a value/output. Functions let you- Abstract out logic in your program. Functions can take other function as an input(callback functions).

single threaded nature of Js It will use only one core of machine at a time. Due to this nature of js, it is considered a bad language for scalable system. Simply, Js runs line by line. http://latentflip.com/loupe/

Synchronous function One after one. Sequential . Only one thing happens at a time. http://latentflip.com/loupe/ As the name suggests synchronous means to be in a sequence, i.e. every statement of the code gets executed one by one. So, basically a statement has to wait for the earlier statement to get executed.

8 minutes 2 minutes 10 minutes 5 minutes Total= 25 minutes

Asynchronous function Opposite of Synchronous. Executes in parts. Multiple things are parallelpiped (i.e. delegate or Context Switch); http://latentflip.com/loupe/ Async simply allows us to write promises-based code as if it was synchronous and it checks that we are not breaking the execution thread.

Common Async Functions setTimeout

fs.readfile

Thank You
Tags