Sir your way of explaining concepts is just amazing, thank you for sharing your experience and helping the newcomers. You are an inspiration for me.. God bless you
I just had a interviuew where this question was asked just with two parameters, we could use apply for this case but if i had knowledge about your channel, i could have ace'd that interview ⚡
** I found this for non-primitive arguments after understanding the concept here ** /* Receives a function which would be memoized*/ function memoize(fn) { /* we'll use this object to store the results */ let cache = {}; /* Returns a function that will receive the arguments that will be passed to the memoized function (fn). */ return (...args) => { /* We stringify the arguments in case they're non-primitive values */ const cacheKey = JSON.stringify(args); /* were the arguments already passed? if no, then store the result */ if (!(cacheKey in cache)) { cache[cacheKey] = fn(...args); } /* We then return the stored result */ return cache[cacheKey]; }; }
sir mujhe topic samaj aa gya at first mujhe ye bhi laga ki ok ho sakta hai ye kuch kam aa jaye with lots of data calculations or something. but the thing is ki maine ye same function without memoization ke bhi jab try kiya to result lagbhag same tha agar same function dubara call kiya to. so i dont know what is this function doing( i know its saving the values of output i get from my functions but time it takes to get the values are smilar to what i will get for not using it)
Hi there, loved all your videos of this playlist. But I have an error I am not getting the same result as yours. My code is running always for the else case. Please help.
value is not going to save in cache let addition=(n)=>{ let sum=0; for(let i = 0; i { let caches={}; console.log(caches) return function(...arg){ let n= arg[0] if(n in caches){ console.log('value is present is cache') return caches[n]
} else{ let result=fun(n); console.log('value is cache',result) result=caches[n] return result } } } const efficient=ExMemo(addition) (efficient(100))
00:00 - Don't skip anything 🙏
Aur kya haal sabke?
btao next topic JS kon sa hona chahiye ??
Use memo per ek videos
Sir ek video how to host react project
Service worker and web worker
It works like dp
Thank you bhaiyaa..
Ek din me bhi successful hokar aapke podcast Parr aaunga❤😂
Wah, kya mast samjhaya hai 👌👌
Best js teacher 👍👍
Very helpful video, I understand it one time - your explanation way is very easy and easy to understand.
Sir your way of explaining concepts is just amazing, thank you for sharing your experience and helping the newcomers. You are an inspiration for me.. God bless you
Thank you 😊
Great way of explanation💥💥
Understood Sir 🤩, You are Great🙌🏻❤️
I just had a interviuew where this question was asked just with two parameters, we could use apply for this case
but if i had knowledge about your channel, i could have ace'd that interview
⚡
Mind blowing explanation . ❤
sir thank u
you explained it very well without leaving any detail
You are hidden treasure for me bhaiya❤
Understood bro
Keep uploading such interview questions
Very humble , good and cool man.
Beautiful✨ Explanation, neat, clean code
Absoluty beautiful explanation.
Thank you very much Guru🙏🙏🙏🙏🙏🙏
sir ji aap shaandaar ho
Nice series 👌👌🙂🙂🙂🙂
Wonderfull Explanation!!, Like and sub done for explanation.
Thank you so much broh ❤️
Maja aa gaya bhaiya....
Awesome 🔥🔥
Bhaiya ji next Should be on Important topic witch you have not covered yet.
good explanations sir
mja agya yr
excellent
Very nicely understood .
but didn't got the same value like yours .
GReat explanation bro
छोटे भाई क्या घुस कर बताता है। पता है तेरी खासियत क्या है एकदम जड़ से पकड़ कर जो समझाता है साला मुर्दा भी रॉकेट बन जाएगा।🙏🔥
फायर है रे तू 👍
thank you so much bhaishab
** I found this for non-primitive arguments after understanding the concept here **
/* Receives a function which would be memoized*/
function memoize(fn) {
/* we'll use this object to store the results */
let cache = {};
/* Returns a function that will receive the arguments that will be passed to the memoized function (fn). */
return (...args) => {
/* We stringify the arguments in case they're non-primitive values */
const cacheKey = JSON.stringify(args);
/* were the arguments already passed? if no, then store the result */
if (!(cacheKey in cache)) {
cache[cacheKey] = fn(...args);
}
/* We then return the stored result */
return cache[cacheKey];
};
}
We can use map object to reduce coding perspective as well bro
hello ji
I liked the way you explained things
your next topic will be based on debouncing and throttling
thank you
Middleware per ek video banao na sir,🙏
Thank you sirji..✌✌
thanks bro , you made js easy
nice explain Thanks for this video
Sir pdf hai jis mein javascript ke interviews ke saare topic ho ?
Nice 👍🏼
great!
bhaiya iss type ke javascript aur other technology like node express react mai video chaiye
Hi. Is it necessary to use rest operator? It would work without it.
sir mujhe topic samaj aa gya at first mujhe ye bhi laga ki ok ho sakta hai ye kuch kam aa jaye with lots of data calculations or something. but the thing is ki maine ye same function without memoization ke bhi jab try kiya to result lagbhag same tha agar same function dubara call kiya to. so i dont know what is this function doing( i know its saving the values of output i get from my functions but time it takes to get the values are smilar to what i will get for not using it)
level
@TechnicalSuneja sir aap konsi company me software engineer ho.
Pls make one video for service worker and web worker..
currying memoisation closure lexical scope higher order function ye saare ek dusre se linked hai!
It is just like dynamic Programming
KB tk aa jayega usemomo ka video sir
Please continue JS interview questions
How to do this with muliple arguments
Hi there, loved all your videos of this playlist. But I have an error I am not getting the same result as yours. My code is running always for the else case.
Please help.
What do the words associative arrays , lookup table,cache hit/miss ratio have in common with memoization?
let sum = 0;
const addSum = (n) => {
for (let i = 0; i < n; i++) {
sum += n;
}
return sum;
};
const momoize = (addSum) => {
let cache = {};
return function (...args) {
let n = args[0];
if (n in cache) {
console.log("from cache");
console.log(cache);
return cache[n];
} else {
console.log("calculating first time");
console.log(cache);
let result = addSum(n);
cache[n] = result;
return result;
}
};
};
console.time();
const efficient = momoize(addSum);
console.log(efficient(4));
console.timeEnd();
Reason: zip END header not found
Exception in thread "main" java.util.zip.ZipException: zip END header not found
Is there any thing wrong in my code? Its executing else part every time. pasted the code below in comment.
how to clear cache
ex: efficient.clear()
Sir, how can i get your source code ?
please answer me !
Why you also did''t got the same value ?
thoda difficult laga yeh episode
value is not going to save in cache
let addition=(n)=>{
let sum=0;
for(let i = 0; i {
let caches={};
console.log(caches)
return function(...arg){
let n= arg[0]
if(n in caches){
console.log('value is present is cache')
return caches[n]
}
else{
let result=fun(n);
console.log('value is cache',result)
result=caches[n]
return result
}
}
}
const efficient=ExMemo(addition)
(efficient(100))
Premium video
Please provide notes
send the code
kuch samaj nahi aaya🤦♂
Awesome 🔥❤️