7.5 Years Experienced Best Javascript Interview | Chakde Frontend Interview EP - 04

  Рет қаралды 18,400

Chirag Goel

Chirag Goel

Күн бұрын

Пікірлер: 114
@artofcoding2010
@artofcoding2010 7 ай бұрын
Best interview series on internet. This video made my day. Thanks Chirag sir once again for this gem
@engineerchirag
@engineerchirag 7 ай бұрын
Thanks a ton ❤️
@011arunkumar8
@011arunkumar8 7 ай бұрын
Hi Chirag,I have 1.5 years of experience. Just one week ago, an interviewer asked me the same first question (auto retry api). At that time, I wasn’t able to answer that question😢. I wish I had found this video a little earlier😅. Thank you, Chirag, always love your videos.
@pasito287
@pasito287 7 ай бұрын
🎉🎉🎉🎉
@engineerchirag
@engineerchirag 7 ай бұрын
Awesome. More videos to come. Keep learning, keep sharing 🚀
@engineerchirag
@engineerchirag 7 ай бұрын
❤️❤️
@shubhamthaker9380
@shubhamthaker9380 7 ай бұрын
which company and can you please tell me some more intresting questions asked
@ankitkashyap2005
@ankitkashyap2005 7 ай бұрын
Hey , the question levels are just awesome.. I can't even imagine that this type of questions can be asked in interviews... Will follow this series to be updated
@engineerchirag
@engineerchirag 7 ай бұрын
Awesome. Keep learning, keep sharing 🚀
@chromegoogle-yi4jv
@chromegoogle-yi4jv 7 ай бұрын
Good stuff, many things to learn
@engineerchirag
@engineerchirag 7 ай бұрын
Glad you liked it. Keep watching, keep sharing 🚀
@lalit422
@lalit422 7 ай бұрын
Amazing work @Chirag. Even though I have 13 years of experience and have learned a lot from you, Thanks, bro
@niranjannaik975
@niranjannaik975 4 ай бұрын
The interesting thing about this interview series is that Chirag always gives you a chance to correct your mistakes. We know that while doing live feature development or coding, we will make small mistakes. Chirag notices those mistakes and give small hints to correct the issues. Thank you, Chirag, for making this amazing series. 👍
@engineerchirag
@engineerchirag 4 ай бұрын
❤️
@jsuryakt
@jsuryakt 7 ай бұрын
Great interview and top candidate 🚀
@engineerchirag
@engineerchirag 7 ай бұрын
Awesome ❣️ Many more to come. Keep watching, keep sharing 🚀
@wadhwa_neeraj
@wadhwa_neeraj 7 ай бұрын
I think Pawan was updating the timestamp at the time of getting the data/key, that's why the timestamps at the end are the same (same problem as the setAsyncData being passed 0 for timeout value in setTimeout).
@premkumarnayak2579
@premkumarnayak2579 7 ай бұрын
Chirag, I have following you since a while, I would say you are doing a great job. 👍👍 The Problem statements you come up with are very unique and organised, I am learning a lot from this series. I was expecting someone from same experience level to come for this series. I wish I would be there some day on this series as well 😂, Just Kidding. For Pavan, I would say, He should be pushed to next Round. 👍 keep up the great work.
@engineerchirag
@engineerchirag 7 ай бұрын
Thanks for the feedback ❣️
@gunjanvyas695
@gunjanvyas695 7 ай бұрын
Yooo!!! Best js interview of the whole Chakde frontend interview series. My solution: //LRU cache automatic cache clear // approach 1: which came to my mind at first /* lets have a cache array in which i'll be putting cache data and will try to add the time when we have added it in it. will run a auto clear cache function after certain time and it will check sort the array based on time, the items which are added. will remove least recently used */ let count = 0; let cache = new Array(5); cache.fill({ item: "2", time: 10 }); function addToCache(data) { let currentTime = Date.now(); cache.push({ item: data, time: currentTime + count }); count++; } function LRU(data) { cache.sort((a, b) => a - b); let leastRecentlyUsed = cache[0]; console.log("leastRecentlyUsed", leastRecentlyUsed); cache.shift(); addToCache(data); } function pushDataToCache(data) { if (cache.length !== 5) { addToCache(data); } else { LRU(data); } } pushDataToCache(40); pushDataToCache(50); pushDataToCache(60); pushDataToCache(30); pushDataToCache(10); pushDataToCache(1); pushDataToCache(50); console.log(cache); function getValueFromCache(data){ let finding = cache.find(item => item.item === data); if(!finding){ console.log(data, "Not found"); return; } console.log(data, "Yes item found",finding); } getValueFromCache(50); getValueFromCache(40); Thank you, Chirag Sir
@engineerchirag
@engineerchirag 7 ай бұрын
Great you liked it ❤️
@sumitgupta7553
@sumitgupta7553 2 ай бұрын
Chirag, You are doing fabulous. I'm learning a lot from your mock interviews. But I do have one query here that your advise to keep map as data structure of cache which will maintain the insertion order and will help us to identify which key should be going to delete while setting new key but when we are going to set one more key in the cache after getting/accessing values from cache then the time will be updated but not the insertion order then still we need to figure out which time stamp is lowest to be excluded using loop. Please correct if I'm thinking in a wrong way and thanks in advance!
@Pawansoni432
@Pawansoni432 5 ай бұрын
Please keep on doing this.. i love it chirag! Thanks ❤❤
@engineerchirag
@engineerchirag 5 ай бұрын
Keep supporting me, keep sharing these videos on LinkedIn and I will try to bring more and more quality content on KZbin. #goodkarma
@SumitKumar-no3nt
@SumitKumar-no3nt 26 күн бұрын
ese kehte interview questions great
@wickkjohn
@wickkjohn 7 ай бұрын
Geeting something new everytime,
@Coding_Asmr_PraDev
@Coding_Asmr_PraDev 7 ай бұрын
Keep the series going, really helpful
@engineerchirag
@engineerchirag 7 ай бұрын
Keep learning, keep sharing 🚀
@satyamraoy
@satyamraoy 4 ай бұрын
can some help me if for the first question where we need to create a function that retry a promise n number of times will this code work this is not proper production ready just a rough to get the idea function retryFetch(fetch, maxRetyCount) { fetch().then(function (res) { console.log(res); }).catch(function (err) { console.log(err); if (maxRetyCount) { maxRetyCount -= 1; retryFetch(fetch, maxRetyCount); }else{ console.log("rety attempt failed",err); } }); } function fetcher() { return ( new Promise(function (res, rej) { if (Math.random() > 0.5) { res("resolved"); } else { rej("rejected"); } }) ); } I tested it myself seems to be working cna someone proof read it for me I just tried to keep it simple
@Piyush-xv1bb
@Piyush-xv1bb 7 ай бұрын
One more Gem from Chakde frontend ❤❤❤
@engineerchirag
@engineerchirag 7 ай бұрын
Keep watching, keep sharing 🚀 Many more to come ❤️
@mirage4731
@mirage4731 5 ай бұрын
1st Question - I created a counter and a function which will be executed inside it async function fetchWithAutoRetry(fetcher, maxtry = 5) { let count = 1; async function fetchData() { try { return await fetcher(); } catch (err) { console.error(`Attempt ${count} failed.`, err); if (count < maxtry) { count++; return await fetchData(); } else { throw new Error("Max retry reached"); } } } return await fetchData(); } const p1 = () => { return new Promise((res, rej) => res(1)); }; const p2 = () => { return new Promise((res, rej) => (Math.random() < 0.1 ? res(2) : rej(3))); }; fetchWithAutoRetry(p1, 5) .then((item) => { console.log("fetcher 1", item); }) .catch((err) => { console.error("fetcher 1", err); }); fetchWithAutoRetry(p2, 5) .then((item) => { console.log("fetcher 2", item); }) .catch((err) => { console.error("fetcher 2", err); });
@madhanrock5390
@madhanrock5390 7 ай бұрын
Thank you so much for spending time in mock interviews and sharing with us. Wonderful session as always ☺️
@engineerchirag
@engineerchirag 7 ай бұрын
Glad you enjoyed it! ❣️
@CK-ir2ke
@CK-ir2ke 7 ай бұрын
Really nice learning something different from you always new things, please add time stamps if its possible?
@engineerchirag
@engineerchirag 7 ай бұрын
Noted. 👍
@megatron9151
@megatron9151 7 ай бұрын
Really good choice of questions. Learnt a lot
@engineerchirag
@engineerchirag 7 ай бұрын
Glad to hear! ❣️
@kumarswamy2979
@kumarswamy2979 7 ай бұрын
amazing session. So much to learn. Thanks a lot, Chirag for the take up this series.
@engineerchirag
@engineerchirag 7 ай бұрын
Glad you liked it❤️
@ganeshbingi4782
@ganeshbingi4782 2 ай бұрын
Can we maintain a counter for times of access then we compare based on it least accessed to identify. Will it work?
@MohamedIkram-z5r
@MohamedIkram-z5r 3 ай бұрын
Hi chirag, I'm interested to give mock interview
@dhirendraKVlogOfficial
@dhirendraKVlogOfficial 2 ай бұрын
We Can solve like this. We don't need to use Math.random we can write like this if promise reject then function should call Max Count time. async function fetchAutomatically(fetcher, maxCount) { if (maxCount { return new Promise((res, rej) => rej('Passed')); }; fetchAutomatically(fetcherFn, 5);
@sauravkumarjha6162
@sauravkumarjha6162 7 ай бұрын
Good stuff. Chiraj could you please upload the mock interview for 2 years experienced candidates.
@engineerchirag
@engineerchirag 7 ай бұрын
Definitely. It's in pipeline. Will be live soon 🚀
@sauravkumarjha6162
@sauravkumarjha6162 7 ай бұрын
@@engineerchirag Thanks
@ankushladani496
@ankushladani496 7 ай бұрын
Thanks Sirji...❤🎉
@engineerchirag
@engineerchirag 7 ай бұрын
❣️
@PRANAVMAPPOLI
@PRANAVMAPPOLI 7 ай бұрын
Hi chirag , So for LRU cache question , are you expecting the solution with map & linked list?
@engineerchirag
@engineerchirag 7 ай бұрын
Both are good options 😃
@pratikwadekar4981
@pratikwadekar4981 7 ай бұрын
What is the code editor that you are using Chirag ?
@deep90402
@deep90402 7 ай бұрын
Please make videos for react interview as well
@engineerchirag
@engineerchirag 7 ай бұрын
Hey watch this react interview and stay tuned more react interviews are lined up kzbin.info/www/bejne/q3mqpa14o52fq6ssi=O24RWRLpjAbZlEm0
@shubhamsaini5542
@shubhamsaini5542 7 ай бұрын
very knowledgeable
@onecuriousmuggle
@onecuriousmuggle 7 ай бұрын
Great set of questions, Chirag. Though, I have a doubt here, Using Map would be helpfull to handle the space complexity better but how is the order insertion helpful? As in map order is only updated at the time whn the values are set for the first time so later on when we set it or last access it, order wont be updated.
@engineerchirag
@engineerchirag 7 ай бұрын
❤️
@prashanttrar9599
@prashanttrar9599 5 ай бұрын
In case of update, we can first delete the old key from map and then re-insert it, that will maintain the order.
@vanchivikash3586
@vanchivikash3586 7 ай бұрын
can i know where can i get practice problems like those in the video
@engineerchirag
@engineerchirag 7 ай бұрын
Every Saturday on Chakde Frontend Interview series 😛
@mayurwankhade7447
@mayurwankhade7447 7 ай бұрын
Please share which tool you are using for questions? First i thought it was codepen. But it is something different. Is it made by you?
@engineerchirag
@engineerchirag 7 ай бұрын
DM pls
@mayurwankhade7447
@mayurwankhade7447 7 ай бұрын
@@engineerchirag hello sir, tried to DM on Twitter but it is only for blue tick users. Cannot dm there. Should I dm on LinkedIn?
@sudiptakumardas3547
@sudiptakumardas3547 7 ай бұрын
Hi Chirag, Can you please suggest some resource where we can practice these type of question?
@engineerchirag
@engineerchirag 7 ай бұрын
Chakde Frontend Interviews series 😛
@nisargbarot1998
@nisargbarot1998 7 ай бұрын
Hi Chirag sir, can you suggest some resources where we can practice these kind of questions to prepare for our interview.
@engineerchirag
@engineerchirag 7 ай бұрын
Chakde Frontend Interviews series 😛
@BLcKHCK-ct4wn
@BLcKHCK-ct4wn 7 ай бұрын
Love from kerala ❤
@PRANAVMAPPOLI
@PRANAVMAPPOLI 7 ай бұрын
🥳me too
@deep90402
@deep90402 7 ай бұрын
How should junior developer should answer in interview and explain our approach to the interviewer.
@engineerchirag
@engineerchirag 7 ай бұрын
These interviews will help you
@keshavkuljeet2929
@keshavkuljeet2929 7 ай бұрын
what online compiler are you using to code?
@engineerchirag
@engineerchirag 7 ай бұрын
DM pls
@AmitGupta-su3yw
@AmitGupta-su3yw 7 ай бұрын
You bring really good question @chirag but I will not select this man as he has 9yr of exp. and instead of making thing simple, he just make it more complicated. btw thanks for bringing such a question which will help people to thinks in real-time when a person giving interview.
@engineerchirag
@engineerchirag 7 ай бұрын
Thanks for feedback 👍
@kanaiyatiwari6748
@kanaiyatiwari6748 7 ай бұрын
can you make video on how senior developer code and review code of junior developer
@engineerchirag
@engineerchirag 7 ай бұрын
Noted 👍
@Herxh428
@Herxh428 7 ай бұрын
+1
@mohammadsalman9370
@mohammadsalman9370 7 ай бұрын
Hi Chirag, I have 5+ years of experience in UI development with Tech skills: HTML5,CSS3 Bootstrap,Tailwind CSS,Responsive Design, Media Queries. I have knowledge on Javascript and Vuejs framework just i want to improve deep knowledge and Strong experience in Javascript and other Framework like React. I know the way how to do but coming to real time, i am facing difficulty to solve problems and logical ways. Can you suggest how can I overcome from this difficulties to solve problems in logical way.
@engineerchirag
@engineerchirag 5 ай бұрын
It sounds monotonous but the fact is you can overcome your fear by practicing more and more. Also, you can leverage AI (ChatGpt) where ever you stuck while coding first try to solve on your own & still won't be able figure out then go and ask Gpt. You can try this method.
@LakshmiPutrevu-qw9lb
@LakshmiPutrevu-qw9lb 2 ай бұрын
Hi Chirag Sir, I have 2-3 years of Experience in JavaScript can i get a chance to do a Mock Interview With you or at least can i get some advice to crack the frontend Coding Interviews from you? Awaiting for your Acknowledgment, Thank you
@minter-07
@minter-07 7 ай бұрын
What platform you are using to write code? Btw nice and informative video, a request is, your voice echoes a lot so please if possible improve it thanks for the video ❤
@engineerchirag
@engineerchirag 7 ай бұрын
Let me work on Audio quality 👍
@minter-07
@minter-07 7 ай бұрын
@@engineerchiragthank you sirji btw what platform it is on which candidate is coding?
@kishanmundadiya4982
@kishanmundadiya4982 7 ай бұрын
Sir, what about backend mock interview 😅
@engineerchirag
@engineerchirag 7 ай бұрын
Haha apka hukum sar akho par 😛
7 ай бұрын
Asking Just out of curiosity Being an engineering manager at MS, how much you need to code in daily basis?
@engineerchirag
@engineerchirag 7 ай бұрын
I find time for coding 😃
@DvvAvinash
@DvvAvinash 7 ай бұрын
Hi Chirag, would you be open to conducting a mock interview with me? I’d really appreciate your guidance and feedback. Thanks!
@engineerchirag
@engineerchirag 7 ай бұрын
Fill the form
@SanjayYadav-ur4qj
@SanjayYadav-ur4qj 7 ай бұрын
Great learning. One doubt, If we use a map then time complexity would still be O(n). Right? What do you think about my solution? I didn't use timestamp. Just used a queue. class LRUCache { constructor(size = 20) { this.cache = {}; this.keys = []; this.size = size; } #moveToMostRecentlyUsed(key) { let indexOfKey = this.keys.indexOf(key); while (indexOfKey < this.keys.length - 1) { const temp = this.keys[indexOfKey]; this.keys[indexOfKey] = this.keys[indexOfKey + 1]; this.keys[indexOfKey + 1] = temp; indexOfKey++; } } set(key, data) { if (Object.hasOwn(this.cache, key)) { this.#moveToMostRecentlyUsed(key); } else { if (this.keys.length >= this.size) { const lruKey = this.keys.shift(); delete this.cache[lruKey]; } this.keys.push(key); this.cache[key] = data; } } get(key) { if (!Object.hasOwn(this.cache, key)) { return; } this.#moveToMostRecentlyUsed(key); return this.cache[key]; } delete(key) { if (!Object.hasOwn(this.cache, key)) return; delete this.cache[key]; this.keys.splice(this.keys.indexOf(key), 1); } } /************ Test Cases **************/ const lruCache = new LRUCache((size = 3)); // lruCache.set("1", "one"); // lruCache.set("2", "two"); // lruCache.set("3", "three"); // lruCache.set("2"); // lruCache.set("4", "four"); // // lruCache.delete("4"); // console.log(lruCache.keys.at(-1)); function asyncData(key, data, time) { setTimeout(() => { lruCache.set(key, data); }, time); } asyncData("1", "one", 0); asyncData("2", "two", 0); asyncData("3", "three", 0); asyncData("4", "four", 0); setTimeout(() => { console.log(lruCache.keys.at(-1)); console.log(lruCache.get("2")); console.log(lruCache.keys.at(-1)); }, 2000);
@samudralaraju3594
@samudralaraju3594 7 ай бұрын
Hi sir my self raju .I have been completd gradution since 2018 bsc(science background).After i am prepared competative exms but could not clear the exms.i am intrested to frontend developer can i learn frontend course.your valuble suggestion sir. i am also telugu medium background student
@engineerchirag
@engineerchirag 5 ай бұрын
What motivates you to learn and choose frontend development? If you answer this then only I can help you with better suggestion.
@yashsolanki069
@yashsolanki069 7 ай бұрын
I've had some bad experiences with object in terms of maintaining the order. If the key is something that can be sorted the object follows the sorting stuff. Really weird shit in js. new Map() is what i had solved some of the order maintaining challenges so that should work here as well. I must say pawan's skills are top notch💯 Thanks again for bringing the best content out there Chirag!!!
@engineerchirag
@engineerchirag 7 ай бұрын
❤️
@karthiksundaram544
@karthiksundaram544 7 ай бұрын
@engineerchirag
@engineerchirag 7 ай бұрын
❣️
@suryasaini1844
@suryasaini1844 7 ай бұрын
I want to give the mock interview. But I don't think I can pass! 😂
@engineerchirag
@engineerchirag 7 ай бұрын
Fill the form.
@sumitkumardey3268
@sumitkumardey3268 7 ай бұрын
Lovey @chirag. Best of Luck
@engineerchirag
@engineerchirag 7 ай бұрын
❤️
@mirage4731
@mirage4731 5 ай бұрын
Made an LRU Cache and Implemented it inside a memorize function (from 1st interview video) - class LRUCache { constructor(capacity) { this._capacity = capacity; this._map = new Map(); } get = (key) => { //see if the key exists if (this._map.has(key)) { // Key exists, get the value and move it to the last index because it is the recently used const value = this._map.get(key); this._map.delete(key); this._map.set(key, value); return value; } else { // Key doesnt exists, return -1 return -1; } }; set = (key, value) => { // see if the key exists const prevValue = this.get(key); //if key exists, then move it to the right. if (prevValue !== -1) { this._map.delete(key); this._map.set(key, value); } // if key doesnt exists, delete the least used and insert this one. else { // Key doesnt exists, see if the capacity is reached if (this._map.size === this._capacity) { //delete the first index for (let [firstKey] of this._map) { this._map.delete(firstKey); break; } } // insert the key this._map.set(key, value); } }; } function memoize(fn, cacheSize) { const cache = new LRUCache(cacheSize); return function (...args) { console.log(cache._map); const key = args.join(); if (cache.get(key) !== -1) { console.log("Getting for cache"); return cache.get(key); } else { const result = fn(...args); cache.set(key, result); return result; } }; }
@ssmohanty153
@ssmohanty153 7 ай бұрын
Keep the series going, really helpful
@engineerchirag
@engineerchirag 7 ай бұрын
Thanks, pls help to spread this series 🙏❤️
@mayurwankhade7447
@mayurwankhade7447 7 ай бұрын
Please share which tool you are using for questions? First i thought it is codepen. But it is something different. Is it made by you?
@engineerchirag
@engineerchirag 7 ай бұрын
DM pls
Как Ходили родители в ШКОЛУ!
0:49
Family Box
Рет қаралды 2,3 МЛН
How to prepare your Frontend System Design Interview
13:21
I Code It
Рет қаралды 30 М.
2.5 Years Experienced Best JavaScript Interview
2:03:06
Anurag Singh ProCodrr
Рет қаралды 333 М.