Currying in Javascript | JS Interview Questions

  Рет қаралды 337,935

Akshay Saini

Akshay Saini

Күн бұрын

Пікірлер: 187
@singlapriyanka97
@singlapriyanka97 4 жыл бұрын
Hey Akshay! Concise and precise explanation, really. I am finally able to understand some core JS concepts. Please please make a video on Closures and Lexical Scoping. This seems to be a hot topic in many JS interviews and have been struggling to find a good explanation on these particular topic. I totally understand and able to connect the dots with your explanation. Cheers! Looking forward for some more videos super soon :D
@vinothkumarv9722
@vinothkumarv9722 4 жыл бұрын
Check it now day he is explained those concept from Namaste 🙏 JS ❤️❤️❤️❤️
@kalaiselvamg9884
@kalaiselvamg9884 3 жыл бұрын
Absolutely ridiculous how most explanations out there make it seem so complex, yet you nailed it on the first try. Great video !!
@0xFOXHOUND
@0xFOXHOUND 4 жыл бұрын
For Revision Function currying 1) Bind method, Take a function, modify it by attaching bind to define a parameter (or method) 2) Closure method Take a function, Define parameter in closure style, define another parameter by just defining it while using as curried version {In python for achieving similar functionality Somewhat similar method is used, called as "Decorators"} Superb explanation Sir!!!
@amitavasengupta3804
@amitavasengupta3804 8 ай бұрын
Ok now my decorator concept is clear too😅😅
@jitendersingh6906
@jitendersingh6906 3 жыл бұрын
Like one has a craze to complete web series these days in a single day, after watching your tutorial from Namaste JS, I am crazy to see each video of your channel, thanks for such great knowledge
@aanavdiaries5170
@aanavdiaries5170 4 жыл бұрын
Hi Akshay, please add use cases of concepts , like why should we use it and where should we use it . It will help us more to relate.
@srujanashankar9517
@srujanashankar9517 4 жыл бұрын
I feel mind blown watching your videos.. all my UI years I was scared of such trivial details, thank you and please continue sharing gyaan like this
@akshaymarch7
@akshaymarch7 4 жыл бұрын
Thank you so much, @Srujana. This comment means a lot. ❤️
@2dabang
@2dabang 5 жыл бұрын
Only yesterday, I was interviewed and was asked the question "What is closure and where it is used?". I had given the page-hit-counter as an example of a closure usage. Now I know what is another usage. Thanks for the valuable posted.
@kirubakaransrinivasan8338
@kirubakaransrinivasan8338 5 жыл бұрын
Hey Akshay, Thanks for spending time to share what you have learnt. The person who knows the pain of learnings something without a teacher. I could see that from your teaching! The way you understood the concepts are really deep, i could see that when you teach it. Excellent job, keep going! 💘 💘
@raxitlakhatariya5915
@raxitlakhatariya5915 2 жыл бұрын
Whenever I have any concern in any topic I search particular topic and Akshay name, if there is any video, That's it I won't try to find any other video. You teaches me so well, that topic just stick to my brain. and fun part is i have not even start this video. i know its gonna be very explanatory. Kudos to you man!
@gauravvanani5581
@gauravvanani5581 4 жыл бұрын
because of you akshay i am fall in love with js, your explanation is very amazing.
@sivaramakrishnakv
@sivaramakrishnakv 3 жыл бұрын
I have always ignored JS, thinking it is weird to type and learn. But two things motivated me. 1. Your tutorials.Especially they are byte sized. 2. The craze of the JS in the tech world. Even if you know more complicated frameworks like Android, iOS it is just not enough. It is complete only with JS. One request from me, it would be great if you can wrap up the video with a mention of real time use case of the concept. Thank You...keep doing more...
@lakshmanpilla1176
@lakshmanpilla1176 3 жыл бұрын
implement sum of two numbers in currying is a question asked in PAYTM. Thankyou for the video its simply amazing :).
@juniorWeb247
@juniorWeb247 2 жыл бұрын
you are the best on youtube, no one can beat you. Thanku so much for your information.
@bhanukiran5089
@bhanukiran5089 8 ай бұрын
I understood the currying in such a way that I won't look any other video for this concept. Thank you @Akshay Saini
@creativecodelab
@creativecodelab 2 жыл бұрын
Akshay, did anyone tell you that this is a masterpiece? Search no further...This indeed is way brilliant of you. I knew about closures but i did not get to understand it this way.😲
@adityaanand4824
@adityaanand4824 3 жыл бұрын
Your concepts are more simplified. Whenever I was seeing JS.... It felt like headache.... Thanks Sir....
@Paras-Mahto
@Paras-Mahto 5 жыл бұрын
Hello Akshay.. Can you please cover all the topics of ES6 features with example.. It will be very helpful to us. The way you Explain and TEACHING the stuff is awesome in camera.
@codingwithgraceandtruth2456
@codingwithgraceandtruth2456 2 жыл бұрын
yet another good tutorial, concise and clearly explained.
@princekumarpatel2066
@princekumarpatel2066 2 жыл бұрын
Hey Akshay, your videos are very deep and detailed. Recently I watched your Namaste JavaScript Series and it was just mind blowing, I got to know so much new things. Thanks a lot
@choudharyrahul722
@choudharyrahul722 3 жыл бұрын
I watch your videos regularly. You explain a concept but you don't explain its practical use which makes your lessons incomplete.
@ferazahmad9102
@ferazahmad9102 2 жыл бұрын
nice and clear explanation,kepp doing we need it
@kashafabdullah2872
@kashafabdullah2872 2 жыл бұрын
Really greatt explanation of each topic of JavaScript
@Sushil2874
@Sushil2874 4 жыл бұрын
Very nicely explained..!! I wish i had some entire js course from scratch to pro in js from this person only..!!
@akshaymarch7
@akshaymarch7 4 жыл бұрын
Now we have it, "Namaste JavaScript" - kzbin.info/aero/PLlasXeu85E9cQ32gLCvAvr9vNaUccPVNP
@aneeshusman1129
@aneeshusman1129 4 жыл бұрын
great knowledge i ever seen in javascript tutorial. good work ;)
@SaveSoilOraganically
@SaveSoilOraganically 3 жыл бұрын
Hey Akshay, your explanation on any topic will be very clear, can you please make part 2 for currying how and where it can be used efficiently.
@motasimrahmankazmi6144
@motasimrahmankazmi6144 4 жыл бұрын
Why are you not continuing this Front end Interview question series? This is pure Gold. All the videos.
@akshaymarch7
@akshaymarch7 4 жыл бұрын
Now we have it as a part of new video series, "Namaste JavaScript" - kzbin.info/aero/PLlasXeu85E9cQ32gLCvAvr9vNaUccPVNP
@priyaarya6883
@priyaarya6883 4 ай бұрын
incisive and clear explanations :))))
@harishkeerthi6697
@harishkeerthi6697 4 жыл бұрын
bro. You are very excellent tutor
@jerrymathew5689
@jerrymathew5689 Жыл бұрын
your patience is himalayas brother.. thankyou for letting all these noobs on board..
@MayankSingh-nk7xj
@MayankSingh-nk7xj 5 жыл бұрын
Sir please aap js pe complete series banaye.. Maine bahut se videos dekhe but aisa conceptualised Explanation khi nahi mila.. Thanku for making it easy
@SowmyaS-n6e
@SowmyaS-n6e Жыл бұрын
Thanks a lot to implement currying using a bind method!
@Starboy_Sandy03
@Starboy_Sandy03 10 ай бұрын
The video explains two ways to achieve function currying in JavaScript - through the use of bind functions and through closures. Currying allows for creating multiple versions of a function by pre-setting some of its arguments. [00:00](kzbin.info/www/bejne/rILGdIGmqsZ9hZo) This section introduces the concept of function currying in JavaScript using bind method. - Function currying can be achieved in JavaScript using bind functions and closures. - The bind method is used to create a copy of a function with preset arguments. - The copied function can be invoked later with the remaining arguments. - The bind method sets the preset arguments as the initial values of the copied function's parameters. [02:04](kzbin.info/www/bejne/rILGdIGmqsZ9hZo) Function currying in JavaScript allows us to create copies of a function with predefined arguments. - By passing an argument to the curried function, it behaves as if the argument was the first parameter. - Currying can be done for any number of arguments. - The bind method is used to create curried functions in JavaScript. [04:08](kzbin.info/www/bejne/rILGdIGmqsZ9hZo) Currying in JavaScript allows us to create new functions with pre-set arguments using either method chaining or function closures. - Method chaining involves creating new methods by pre-setting arguments inside the function. - Function closures involve returning a new function that has access to pre-set arguments even after it's returned. - Currying allows for more flexibility and reusability in code. [06:12](kzbin.info/www/bejne/rILGdIGmqsZ9hZo) The video explains two ways to implement function currying in JavaScript: using the bind method and using closures. - One way to implement currying is by using the bind method. - Another way to implement currying is by using closures. - The video demonstrates creating a multiply by 3 function using the closure concept. - The video concludes by encouraging viewers to give feedback and suggesting future topics for the channel.
@shivangranjan1389
@shivangranjan1389 6 жыл бұрын
This is awesome bhaiya! Have been working with javascript and feel there is still a lot to cover! This initiative of yours will help us a lot. Btw, I am also studying @ your undergrad school.
@akshaymarch7
@akshaymarch7 6 жыл бұрын
It's great to know Shivang, keep practicing you'll become better. All the best 😊👍
@jalluchakri1528
@jalluchakri1528 4 ай бұрын
Hey ! Thanks for explaining function currying
@subhashgn1775
@subhashgn1775 3 жыл бұрын
Got it.... Thank you man!👍👏👏👏
@S4sent
@S4sent 5 жыл бұрын
You are awesome 😎😎😎😎
@akashsingh-ch5xc
@akashsingh-ch5xc 4 жыл бұрын
Even your small explanation makes concept very clear. Loved your knowledge and teaching skills.
@shivankjaiswal3618
@shivankjaiswal3618 3 жыл бұрын
Hi Akshay, Thanks for the best explanation. Nice work.
@ashokcommonman9636
@ashokcommonman9636 Жыл бұрын
Excellent explanation take a bow
@rajendrakumar729
@rajendrakumar729 3 жыл бұрын
Hi Akshay you explained concept so well .It can related and easy to grasp ,thanks a lot :)
@gtr9805
@gtr9805 Жыл бұрын
Thumps up from Nepal !
@itsMohak
@itsMohak Жыл бұрын
You are great
@auroshisray9140
@auroshisray9140 2 жыл бұрын
Thanks bhaiya for making such useful videos
@chetanrathod4780
@chetanrathod4780 4 жыл бұрын
The content is good, but after saw your video I have to Google Search the things to deep dive, and then I have to struggle to understand so can you please add in your every video that why to use this functionality. It will helpful for everyone
@akshatjainbafna
@akshatjainbafna Жыл бұрын
What I think could be the use case is where you want to work with different combinations of dynamic Data.
@jokerlast-l7d
@jokerlast-l7d Жыл бұрын
concise and simple explanation
@02sonali
@02sonali 4 жыл бұрын
Hi, I just love your way of explanation. Could you please explain Partial Application as well and the difference between currying and partial application?
@TheNerdyDev
@TheNerdyDev 5 жыл бұрын
The returned function is inside the lexical environment of the multiply function so it can access the preset variable x that we get from outside multiply function. Correct me if I am wrong and Thanks a lot sir.
@akshaymarch7
@akshaymarch7 5 жыл бұрын
Which part of the video are you referring to? Let me know it clearly. However, according to closures, the returned function has access to the variables which are passed as a reference to the parent function. Hope this clears your doubt. :)
@TheNerdyDev
@TheNerdyDev 5 жыл бұрын
@@akshaymarch7 I meant this only. Please add the code when you get time. :)
@akshaymarch7
@akshaymarch7 5 жыл бұрын
Added for Debouncing, Event Bubbling, Capturing and Polyfill for Bind in the respective video description. Will add for others also and will make sure that I save the code while recording the video next time and add the link right while publishing.
@giannizamora7247
@giannizamora7247 2 жыл бұрын
@2:43 you mention that the value passed in would be y. Just to clarify the value passed in to multiplyByTwo(5) the 5 will = y because in the bind we have already specified binds first 2 arguments which is (this, 2) so the third thing passed in would be like a 3rd arg that then multiply function would take in as well.
@barnabasnanna6845
@barnabasnanna6845 Жыл бұрын
Excellent video
@govindrawat8581
@govindrawat8581 4 жыл бұрын
Very precised and get to learn in the whole video
@heena6814
@heena6814 Жыл бұрын
Hi Akshay, Thank You so much for awesome explanation. Can you please mention the sequence also as there are multiple playlist in your channel. It is little confusing which series we need to check first as there are some topics which are interlinked with each other.
@laxmankumawat6728
@laxmankumawat6728 2 жыл бұрын
I think this is begginer stage well explained but mood not 🔥 But now in namshate javascript Akshay mood is 🔥🔥🔥🔥🔥
@techbro3085
@techbro3085 3 жыл бұрын
Hey Akshay, very good session. thanks a lot
@mohamedyoussef8835
@mohamedyoussef8835 2 жыл бұрын
Awesome explanation +++++++++++++++++++ Thank You
@abhishekpatil4065
@abhishekpatil4065 Жыл бұрын
you are quite good teacher
@justinxten4real657
@justinxten4real657 3 жыл бұрын
great video 100%
@Jayajha11
@Jayajha11 4 жыл бұрын
Awesome explanation
@viveksai9353
@viveksai9353 5 жыл бұрын
It would help a lot if you could create a fully fledged project involving all these concepts so as to highlight there usage in the process of development. Thank you. Great video once again.
@surabhipal9553
@surabhipal9553 3 жыл бұрын
Thank you for teaching us 🙏
@avinashsharma5450
@avinashsharma5450 3 жыл бұрын
Greate Explanation... can you do something for Generator function.
@bhavnasingh3261
@bhavnasingh3261 2 жыл бұрын
Thank you, your videos are so helpful.
@bhavnasingh3261
@bhavnasingh3261 2 жыл бұрын
I am preparing for the UI full stack developer. Please help by making some more important questions asked in interview for the same.
@bikramgupta8261
@bikramgupta8261 4 жыл бұрын
Please put videos in a sequence in playlist, like call, apply and bind method video on top of polyfill video and so on. Otherwise your videos are so easy to understand and crystal clear.
@akshaymarch7
@akshaymarch7 4 жыл бұрын
Can you prepare a better sequence for this playlist and send it to me. I'll do that. 🙏
@AKASHKUMAR-we5hg
@AKASHKUMAR-we5hg 4 жыл бұрын
just a small request Hey Akshay please try to explain with real life scenario where these concept is useful,
@MYashwant7
@MYashwant7 4 жыл бұрын
Hi Akashy , I am a big fan of you Please can you make YT videos related to Data engineer and Data science
@KaziMeraj
@KaziMeraj 2 жыл бұрын
totally on point!
@HarshavardhanJadhav
@HarshavardhanJadhav 3 жыл бұрын
great video A big thank you!
@azadvt7269
@azadvt7269 2 жыл бұрын
What is the currying function Currying is the process of taking a function with multiple arguments and turning it into a sequence of functions each with only a single argument. Currying is named after a mathematician Haskell Curry. By applying currying, a n-ary function turns it into a unary function. 19Let’s take an example of n-ary function and how it turns into a currying function, const multiArgFunction = (a, b, c) => a + b + c; console.log(multiArgFunction(1, 2, 3)); // 6 const curryUnaryFunction = (a) => (b) => (c) => a + b + c; curryUnaryFunction(1); // returns a function: b => c => 1 + b + c curryUnaryFunction(1)(2); // returns a function: c => 3 + c curryUnaryFunction(1)(2)(3); // returns the number 6 Curried functions are great to improve code reusability and functional composition.
@puja-z6c
@puja-z6c 6 ай бұрын
THANK YOU SO MUCH
@Whoisankit
@Whoisankit 4 жыл бұрын
Nice vlogs brother, but i would suggest, you should also mention the benefits of the functions/methodology or why are we using this.
@chandansr5788
@chandansr5788 4 жыл бұрын
You should also explained about multiply(1)(2)(3) which is the main use case of function currying
@ironman-29
@ironman-29 Жыл бұрын
const multiply = function (x) { return function (y) { return function (z) { return console.log(x * y * z); }; }; }; multiply(1)(2)(3); output -> 6
@dysphemic1
@dysphemic1 2 жыл бұрын
awesome
@ganeshkhirwadkar4127
@ganeshkhirwadkar4127 4 жыл бұрын
Hey Akshay, your videos really works. I am practicing parallel in editor as code is to be written not remembered. Just waiting for Closures tutorial.
@akshaymarch7
@akshaymarch7 4 жыл бұрын
Now we have it as a part of new video series, "Namaste JavaScript" - kzbin.info/aero/PLlasXeu85E9cQ32gLCvAvr9vNaUccPVNP
@ganeshkhirwadkar4127
@ganeshkhirwadkar4127 4 жыл бұрын
@@akshaymarch7 Yes 😁 I am already following those sessions. Thanks
@aunmohammad6220
@aunmohammad6220 5 жыл бұрын
Thanks keep updating.
@devendrasuthar5530
@devendrasuthar5530 9 ай бұрын
Hey this is what you will sound like if you don't go deep into the topics as you have gone in namste javascript It was hard to understand bind function implementation. In previous video I hope you will teach these concept again.
@dipanshuverma7659
@dipanshuverma7659 3 жыл бұрын
Hey Akshay!. your explaining technique is quite good. can you please make a video on Arrow function ()=>{} .
@stephen1569
@stephen1569 2 жыл бұрын
Loving your content Akshay. Pure gold !!
@TechSumGyaan
@TechSumGyaan 3 жыл бұрын
It's really helpful. Can u please make video of generator function in js?
@satyasahoo26
@satyasahoo26 4 жыл бұрын
Thx,finally I understood .
@rajkishorsaha8116
@rajkishorsaha8116 Жыл бұрын
nice and thanks...
@Abhinand28
@Abhinand28 11 ай бұрын
Closures do have the super power. they REMEMBER.
@knowladgevibes5748
@knowladgevibes5748 4 жыл бұрын
Nice explanation in the sort. But could you please explore in the videos of why use and why need of this function in the java script .
@diwakaryadav4853
@diwakaryadav4853 5 жыл бұрын
your concept is good....can u make video on ECMAScript6 and its all feature and function....i m sure you will get best suscription...i m seeing many javascript video .....but your video are awesome in javascript....please make more video and i will tell my friend to subscribe
@akshaymarch7
@akshaymarch7 5 жыл бұрын
First of all thanks a lot for the nice words. Glad to know that you like the videos. But one doubt, isn't there already so much good content available regarding ES6 on KZbin. Doesn't that help? I'm trying to cover topics which aren't explained properly and people struggle with them. But thanks for suggesting, I've noted it down anyways, will try to cover that as well ASAP.
@pradnyakulkarni2028
@pradnyakulkarni2028 3 жыл бұрын
You can add what currying is , in this video alike you explained in closure 😇 some interviewer ask theatrical definition 😅
@salwenikhil456496
@salwenikhil456496 3 жыл бұрын
What is the use of curring function and any practical example of u provide will be good.
@arvindbarala4525
@arvindbarala4525 5 жыл бұрын
great, plz also make polyfill for call and apply
@saikumarduggana2877
@saikumarduggana2877 5 жыл бұрын
Can you tell about shadow dom and rest api and soap model with a clear example. Thanks for your videos really helpful
@jagrutitiwari2551
@jagrutitiwari2551 4 жыл бұрын
Hi. Loved your explanations. Could you please make a video on closures?
@akshaymarch7
@akshaymarch7 4 жыл бұрын
Now we have it as a part of new video series, "Namaste JavaScript" - kzbin.info/aero/PLlasXeu85E9cQ32gLCvAvr9vNaUccPVNP
@shankarganeshjayaraman4886
@shankarganeshjayaraman4886 3 жыл бұрын
Can you please explain how the bind function is used for achieving currying? Currying is a transformation of a function with multiple arguments into a sequence of nested functions with a single argument. Bind takes two arguments which are reference object and value, with the copy variable second method is called. Can the bind method used for nested functions that accepts single arguments?
@mayankgupta7988
@mayankgupta7988 5 жыл бұрын
can you make the video about some rxjs opeartors and explain what happens behind the scenes in those operator.
@jagdishbondre3444
@jagdishbondre3444 3 жыл бұрын
Hi Akshay Nice video I am checking on web the concept currying if there is any function multiply (3)(2)(4); what it's mean it is a closure or what? Please explain
@cijokb
@cijokb 5 жыл бұрын
Hi Akshay , when we set the argument using bind say bind(this, 3), this way of presetting the arguments isn't called partial() ? I am confused with partial and curry
@techtube2404
@techtube2404 3 жыл бұрын
Hope this blog post will give a clear understanding of partial and curry functions blog.bitsrc.io/understanding-currying-in-javascript-ceb2188c339. As per this post, the bind(this,3)(10) is a currying function as a single argument is passed at a time.
@ashutoshrathi9744
@ashutoshrathi9744 5 жыл бұрын
the video was good but Can you also solve one of the most frequently/important questions asked for that particular topic to have a better understanding and also it will also give an idea of the use cases.
@akshaymarch7
@akshaymarch7 5 жыл бұрын
Hey Ashutosh, I already have a playlist where I am covering important JS Interview Questions. Please checkout those videos on the channel.
@shivareddy1671
@shivareddy1671 5 жыл бұрын
100th subscriber :)
@akshaymarch7
@akshaymarch7 5 жыл бұрын
Thank you so much Shiva, I was waiting for 100 since a long time. So now, I'll make a separate video dedicating you. Tell me a topic. 😊
@habeeb196
@habeeb196 5 жыл бұрын
NVM Him, Make a video on closures
@CatsAndCarnivores
@CatsAndCarnivores 2 жыл бұрын
a bit different with strings - prints first params in bind, ignores call param if over limit let print = function(first, second) { console.log(first + ' '+ second) }; let call1 = print.bind(this, "one"); call1("two"); let call2 = print.bind(this, "three", "four"); call2("two"); let call3 = print.bind(this, "three", "four", "five"); call3("two"); OUTPUT > "one two" "three four" "three four"
@Mr.Zeus11
@Mr.Zeus11 9 ай бұрын
so basically function currying can be implemented two ways. 1: with help of closures & higher-order functions 2: With bind method
@IamAfrah
@IamAfrah Жыл бұрын
👍👍👍👍
@deepakkumard8794
@deepakkumard8794 3 жыл бұрын
Could you explain where exactly in real-life we are using this currying concept ?
@PraveenKumar-wx5yt
@PraveenKumar-wx5yt Жыл бұрын
It could have been more exhaustive. still very well explained
@yashvashisth4591
@yashvashisth4591 3 жыл бұрын
You are a Brahmastra for JAVASCRIPT... haha... :-P
@learntocode8012
@learntocode8012 4 жыл бұрын
I’m learning core concept of js. Need more info about when what to use function curry or closure ?
async vs defer attributes in Javascript | Ola Interview Question
8:10
call, apply and bind method in JavaScript
10:50
Akshay Saini
Рет қаралды 492 М.
Debouncing in Javascript | Flipkart UI Interview Question
16:20
Akshay Saini
Рет қаралды 243 М.
10 JavaScript Interview Questions You HAVE TO KNOW
13:41
James Q Quick
Рет қаралды 78 М.
Programming Is NOT Enough | Add these 7 skills…
13:19
Travis Media
Рет қаралды 423 М.
Closures in JS 🔥 | Namaste JavaScript Episode 10
22:44
Akshay Saini
Рет қаралды 892 М.
JavaScript Interview Prep: Functions, Closures, Currying
1:29:03
freeCodeCamp.org
Рет қаралды 165 М.
Event Delegation in Javascript | UI/Frontend Interview Question
27:45
map, filter & reduce 🙏 Namaste JavaScript Ep. 19 🔥
37:42
Akshay Saini
Рет қаралды 948 М.