Frontend Interview Question | What are Pure Functions? | SideEffects | Javascript Interview

  Рет қаралды 6,153

Nisha Singla

Nisha Singla

Күн бұрын

Hello Everyone
In this session, we will learn about Pure Functions in Javascript and this is one of the asked question in Interview .
What are Pure Functions?
Function that produces the same output for the same input. It means it returns the same result when you pass the same arguments. A pure function shouldn't have any side effects to change the expected output
We need to make sure functions are,
Predictable: It produces a predictable output for the same inputs.
Readable: Anyone reading the function as a standalone unit can understand its purpose completely.
Reusable: Can reuse the function at multiple places of the source code without altering its and the caller's behavior.
Testable: We can test it as an independent unit.
What is SideEffect ?
Any operation that is not directly related to the final output of the function is called a Side Effect
A few more classic cases of the side effects are,
1)Mutating(changing) the input itself.
2) Querying/Updating DOM
3 )Logging(even in the console)
4) Making an XHR/fetch call.
Check another important interview Question
• Frontend Interview Que...
Check video on Recursion
• What is Recursion | Ja...
Support my channel by liking and sharing my videos so that I can reach to wider audience. Please share it in your network 🙏
Connect with me on social platform:
Facebook: / angularjs4beginners
LinkedIn: / nisha-singla-82407aa0
Instagram : / nishasingla05
Twitter: / nishasingla05
For more such interesting videos, please subscribe to my channel and stay connected.

Пікірлер: 10
@buntykhipal5103
@buntykhipal5103 6 ай бұрын
this video helped me a lot to learn difference between pure and impure function thank for making video
@rajesh.geesala7565
@rajesh.geesala7565 7 ай бұрын
Thanks
@gyanendra_chaubey
@gyanendra_chaubey Жыл бұрын
Your questions are awesome and you are doing great job. Is it possible for you to add more FE questions especially tricky ones like the one (async + settimeout + promises one). Anyways thank's for what ever you have posted till date.
@RahulKumar-ew1qw
@RahulKumar-ew1qw Жыл бұрын
Great explanation. Ms
@miw879
@miw879 2 жыл бұрын
very nicely explained :)
@NishaSingla
@NishaSingla 2 жыл бұрын
Thank you 😊
@krishtechhq
@krishtechhq 2 жыл бұрын
Nice !
@NishaSingla
@NishaSingla 2 жыл бұрын
Thank you 😊
@BrijeshSingh-dp1ku
@BrijeshSingh-dp1ku 2 жыл бұрын
Hi Nisha, thanks for sharing.. where you work?
@NishaSingla
@NishaSingla 2 жыл бұрын
😀😀
The Noodle Picture Secret 😱 #shorts
00:35
Mr DegrEE
Рет қаралды 30 МЛН
Они убрались очень быстро!
00:40
Аришнев
Рет қаралды 3,4 МЛН
Just try to use a cool gadget 😍
00:33
123 GO! SHORTS
Рет қаралды 85 МЛН
Pure Functions Javascript - A Way to Avoid Side Effects in Javascript
6:03
Monsterlessons Academy
Рет қаралды 3,4 М.
JavaScript Pure Functions - Tutorial for beginners
19:20
ColorCode
Рет қаралды 10 М.
Learn Pure Functions In 10 Minutes
10:11
Web Dev Simplified
Рет қаралды 142 М.
React js - Top 30 Interview Questions and Answers for Beginners
50:43
Interview Happy
Рет қаралды 255 М.
What are "Pure Functions" and "Side Effects"?
4:49
Academind
Рет қаралды 52 М.
The Noodle Picture Secret 😱 #shorts
00:35
Mr DegrEE
Рет қаралды 30 МЛН