- 89
- 286 035
Learnersbucket
India
เข้าร่วมเมื่อ 13 มิ.ย. 2022
Prepare & Crack your frontend/javascript Interview for product based.
Learn with me how to solve JavaScript interview problems that have been asked in the big tech ORGS and prepare for your interview.
Hello Friends,
This is Prashant Yadav, currently laboring as Senior Frontend Engineer at Razorpay.
Being from a BSc (Computer Science) background, it was not easy for me to land a job at Razorpay. Through this channel, my goal is to help you all tackle your front-end (JavaScript) interview and land a job at a good organization.
Learn with me how to solve JavaScript interview problems that have been asked in the big tech ORGS and prepare for your interview.
Hello Friends,
This is Prashant Yadav, currently laboring as Senior Frontend Engineer at Razorpay.
Being from a BSc (Computer Science) background, it was not easy for me to land a job at Razorpay. Through this channel, my goal is to help you all tackle your front-end (JavaScript) interview and land a job at a good organization.
I coded this Image comparison slider in React
React Interview Question - 70 | In this video, we will see how to solve a medium-difficulty problem asked in a frontend engineer interview to SDE1, SDE2, and SDE3.
We have to implement an image comparison slider component in React within 60 minutes, watch the complete video on how to solve this.
You can expect this frontend system design/coding question in Rippling, Thoughtspot, Uber, Flipkart, Atlassian, Meta, Google, Microsoft, Dropbox, TCS, Infosys, Wipro, Cognizant, Capgemini, Accenture, Nvidia, Nutanix, and other product-based organizations' interviews.
The solution to the solved problem - codesandbox.io/p/sandbox/black-firefly-jgt8qh?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clzf5ejml00062e67imnp3j51%2522%252C%2522sizes%2522%253A%255B100%252C0%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clzf5ejml00022e678rjkp0b4%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clzf5ejml00032e67jc8jqdb9%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clzf5ejml00052e67dhow0xl4%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B72.49429584565928%252C27.50570415434072%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clzf5ejml00022e678rjkp0b4%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clzf5ejml00012e67z4eszaux%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Fsrc%252Findex.js%2522%257D%255D%252C%2522id%2522%253A%2522clzf5ejml00022e678rjkp0b4%2522%252C%2522activeTabId%2522%253A%2522clzf5ejml00012e67z4eszaux%2522%257D%252C%2522clzf5ejml00052e67dhow0xl4%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clzf5ejml00042e67z95d5lp3%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522UNASSIGNED_PORT%2522%252C%2522port%2522%253A0%252C%2522path%2522%253A%2522%252F%2522%257D%255D%252C%2522id%2522%253A%2522clzf5ejml00052e67dhow0xl4%2522%252C%2522activeTabId%2522%253A%2522clzf5ejml00042e67z95d5lp3%2522%257D%252C%2522clzf5ejml00032e67jc8jqdb9%2522%253A%257B%2522tabs%2522%253A%255B%255D%252C%2522id%2522%253A%2522clzf5ejml00032e67jc8jqdb9%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Afalse%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D
Machine-coding questions playlist - th-cam.com/video/_XOToOfrwtc/w-d-xo.html
Check out my "Frontend Interview preparation course" for all levels. In this, you will get
- 120 solved JavaScript problems
- 19 Data structures
- 150 Algorithms
- 20 Design patterns
- 20 Frontend system design questions
- 30 Machine coding / LLD questions
- 20 Custom React hooks
- Plus all the web fundamentals concepts that are required to prepare for your frontend interview.
Checkout the sample frontend system question on "Designing the frontend of video streaming platforms such as Netflix, TH-cam" - alpha.learnersbucket.com/s/preview/courses/Frontend-System-Design-from-prashant-yadav-658bee23e4b0174a3cb6c294#65927298e4b049a44b13a24e
Practically prepare for your JavaScript / Frontend Interview by preparing round following my ultimate JavaScript SDE cheat sheet - learnersbucket.com/javascript-sde-cheat-sheet/
JavaScript SDE cheat sheet Playlist - th-cam.com/play/PL_KW_uw2ITn84SjTLNQsugTU3hU4_EwLM.html
Social links
Twitter - LearnersBucket
Linkedin - www.linkedin.com/in/prashant-yadav-lb/
Blog - learnersbucket.com
We have to implement an image comparison slider component in React within 60 minutes, watch the complete video on how to solve this.
You can expect this frontend system design/coding question in Rippling, Thoughtspot, Uber, Flipkart, Atlassian, Meta, Google, Microsoft, Dropbox, TCS, Infosys, Wipro, Cognizant, Capgemini, Accenture, Nvidia, Nutanix, and other product-based organizations' interviews.
The solution to the solved problem - codesandbox.io/p/sandbox/black-firefly-jgt8qh?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clzf5ejml00062e67imnp3j51%2522%252C%2522sizes%2522%253A%255B100%252C0%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clzf5ejml00022e678rjkp0b4%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clzf5ejml00032e67jc8jqdb9%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clzf5ejml00052e67dhow0xl4%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B72.49429584565928%252C27.50570415434072%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clzf5ejml00022e678rjkp0b4%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clzf5ejml00012e67z4eszaux%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Fsrc%252Findex.js%2522%257D%255D%252C%2522id%2522%253A%2522clzf5ejml00022e678rjkp0b4%2522%252C%2522activeTabId%2522%253A%2522clzf5ejml00012e67z4eszaux%2522%257D%252C%2522clzf5ejml00052e67dhow0xl4%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clzf5ejml00042e67z95d5lp3%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522UNASSIGNED_PORT%2522%252C%2522port%2522%253A0%252C%2522path%2522%253A%2522%252F%2522%257D%255D%252C%2522id%2522%253A%2522clzf5ejml00052e67dhow0xl4%2522%252C%2522activeTabId%2522%253A%2522clzf5ejml00042e67z95d5lp3%2522%257D%252C%2522clzf5ejml00032e67jc8jqdb9%2522%253A%257B%2522tabs%2522%253A%255B%255D%252C%2522id%2522%253A%2522clzf5ejml00032e67jc8jqdb9%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Afalse%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D
Machine-coding questions playlist - th-cam.com/video/_XOToOfrwtc/w-d-xo.html
Check out my "Frontend Interview preparation course" for all levels. In this, you will get
- 120 solved JavaScript problems
- 19 Data structures
- 150 Algorithms
- 20 Design patterns
- 20 Frontend system design questions
- 30 Machine coding / LLD questions
- 20 Custom React hooks
- Plus all the web fundamentals concepts that are required to prepare for your frontend interview.
Checkout the sample frontend system question on "Designing the frontend of video streaming platforms such as Netflix, TH-cam" - alpha.learnersbucket.com/s/preview/courses/Frontend-System-Design-from-prashant-yadav-658bee23e4b0174a3cb6c294#65927298e4b049a44b13a24e
Practically prepare for your JavaScript / Frontend Interview by preparing round following my ultimate JavaScript SDE cheat sheet - learnersbucket.com/javascript-sde-cheat-sheet/
JavaScript SDE cheat sheet Playlist - th-cam.com/play/PL_KW_uw2ITn84SjTLNQsugTU3hU4_EwLM.html
Social links
Twitter - LearnersBucket
Linkedin - www.linkedin.com/in/prashant-yadav-lb/
Blog - learnersbucket.com
มุมมอง: 1 857
วีดีโอ
Implement Resource pool pattern in JavaScript | Thoughtspot MTS-3 Interview Question
มุมมอง 4.4K6 หลายเดือนก่อน
JavaScript Interview Question - 69 | In this video, we will see how to solve a medium-difficulty problem asked in a frontend engineer interview to SDE1, SDE2, and SDE3. We have to implement the resource or object pool design pattern in JavaScript, which creates a pool of objects, manages it, when requested returns an Object from the pool, and releases the object when not required so that it can...
How hard can be this JavaScript Interview Question from UBER?
มุมมอง 9Kปีที่แล้ว
JavaScript Interview Question - 68 | In this video, we will see how to solve a medium-difficulty problem asked in a frontend engineer interview to SDE1, SDE2, and SDE3. We have to implement a function named mapLimit in JavaScript that takes an array of async tasks (promises) and a callback function as input, executes a limited number of tasks in batches, and then after each promise is settled i...
Execute async tasks (promises) in Sequence | JavaScript Interview Question - 68
มุมมอง 3.4Kปีที่แล้ว
JavaScript Interview Question - 67 | In this video, we will see how to solve a medium-difficulty problem asked in a frontend engineer interview to SDE1, SDE2, and SDE3. We have to implement a function named executeAsync in JavaScript that takes an array of async tasks (promises) and a callback function as input, executes all the promises sequentially one after the another, and then after each p...
Execute promises (async function) in parallel | JavaScript Interview Question - 67
มุมมอง 3Kปีที่แล้ว
JavaScript Interview Question - 67 | In this video, we will see how to solve a medium-difficulty problem asked in a frontend engineer interview to SDE1, SDE2, and SDE3. We have to implement a function named executeParallel in JavaScript that takes an array of async tasks (promises) and a callback function as input, executes all the promises in parallel, and then after each promise is settled in...
I got a remote job in a US unicorn with a BSc degree as senior frontend engineer | My Journey
มุมมอง 35Kปีที่แล้ว
In this video, I have talked about my 8 years of professional journey of how I landed a senior frontend engineer job at a US-based sales tech unicorn (Apollo.io) with a BSc degree. I started with a first job at a startup with three employees and then struggled through the service-based organizations before I started getting job offers from big product-based companies. In my career I got the opp...
Proxy design pattern in JavaScript | JavaScript Interview Question - 66
มุมมอง 2.3Kปีที่แล้ว
JavaScript Interview Question - 66 | In this video, we will see how to solve a medium-difficulty problem asked in a frontend engineer interview to SDE1, SDE2, and SDE3. We are going to see what is a proxy design pattern in JavaScript and how it helps to keep the mutation of the objects under control. You can expect this frontend system design/coding question in Rippling, Uber, Flipkart, Atlassi...
Create a lightbox in Reactjs | Frontend Machine Coding Interview Question - 65
มุมมอง 2.6Kปีที่แล้ว
JavaScript Interview Question - 65 | In this video, we will see how to solve a medium-difficulty problem asked in a frontend engineer interview to SDE1, SDE2, and SDE3. We will see how to create a responsive lightbox or image viewer in modal as a functional component in Reactjs with the option to navigate through images in the lightbox. This component is a composition of two components. Modal -...
Modal as functional component in React with backdrop | Reactjs machine coding question - 64
มุมมอง 1.9Kปีที่แล้ว
JavaScript Interview Question - 64 | In this video, we will see how to solve a medium-difficulty problem asked in a frontend engineer interview to SDE1, SDE2, and SDE3. We will see how to create a responsive modal as a functional component in Reactjs with backdrop that will close the modal if clicked outside. You can expect this frontend system design/coding question in Rippling, Uber, Flipkart...
Responsive slideshow in Reactjs | React machine coding question - 63
มุมมอง 1.9Kปีที่แล้ว
JavaScript Interview Question - 63 | In this video, we will see how to solve a medium-difficulty problem asked in a frontend engineer interview to SDE1, SDE2, and SDE3. We will see how to create a responsive slideshow in Reactjs with bulleted navigation and next and previous navigation. You can expect this frontend system design/coding question in Rippling, Uber, Flipkart, Atlassian, Meta, Goog...
Search with pagination in React | Frontend Machine Coding Interview Question - 62
มุมมอง 2.8Kปีที่แล้ว
JavaScript Interview Question - 62 | In this video, we will see how to solve a medium-difficulty problem asked in a frontend engineer interview to SDE1, SDE2, and SDE3. We will see how to create a search component with the pagination to navigate through the results. You can expect this frontend system design/coding question in Rippling, Uber, Flipkart, Atlassian, Meta, Google, Microsoft, Dropbo...
Editable To-Do list in React | Frontend machine coding interview question - 61
มุมมอง 2.3Kปีที่แล้ว
JavaScript Interview Question - 61 | In this video, we will see how to solve a medium-difficulty problem asked in a frontend engineer interview to SDE1, SDE2, and SDE3. We will see how to create an editable to-do list in Reactjs, a classic frontend machine coding interview question that can be implemented in the framework of your choice. You can expect this frontend system design/coding questio...
Publisher-Subscriber Design Pattern in JavaScript | JavaScript Interview Question - 60
มุมมอง 2.3Kปีที่แล้ว
JavaScript Interview Question - 60 | In this video, we will see how to solve a medium-difficulty problem asked in a frontend engineer interview to SDE1, SDE2, and SDE3. We will see what is a pub-sub design pattern and how we can use it to solve recurring problems in the front end. How to create different variations of subscriptions and how to un-subscribe to existing ones. You can expect this f...
Singleton design pattern | Frontend System Design Question
มุมมอง 2Kปีที่แล้ว
JavaScript Interview Question - 59 | In this video, we will see how to solve a medium-difficulty problem asked in a frontend engineer interview to SDE1, SDE2, and SDE3. We will see what is a singleton design pattern and how we can use it to solve recurring problems You can expect this frontend system design/coding question in Rippling, Uber, Flipkart, Atlassian, Meta, Google, Microsoft, Dropbox...
Encode string with HTML tags at given characters | JavaScript Interview Question - 59
มุมมอง 982ปีที่แล้ว
JavaScript Interview Question - 59 | In this video, we will see how to solve a medium-difficulty problem asked in a frontend engineer interview to SDE1, SDE2, and SDE3. Given a string and a style array render HTML pretty much like a rich text editor. For example: 'Hello, world', [[0, 2, 'i'], [4, 9, 'b'], [7, 10, 'u']] You can expect this frontend coding question in Rippling, Uber, Flipkart, At...
Code an In memory search engine | JavaScript Interview Question - 58
มุมมอง 1.3Kปีที่แล้ว
Code an In memory search engine | JavaScript Interview Question - 58
Highlight keywords on the webpage | JavaScript Interview question - 57
มุมมอง 1.1Kปีที่แล้ว
Highlight keywords on the webpage | JavaScript Interview question - 57
Stepper component in React | Frontend machine coding question
มุมมอง 5Kปีที่แล้ว
Stepper component in React | Frontend machine coding question
Throttle an array of tasks | Uber frontend interview question
มุมมอง 2.2Kปีที่แล้ว
Throttle an array of tasks | Uber frontend interview question
3 different type of throttle function in JavaScript | JavaScript Interview Question - 53
มุมมอง 1.9Kปีที่แล้ว
3 different type of throttle function in JavaScript | JavaScript Interview Question - 53
Create useWhyDidYouUpdate() hook in React | React Machine Coding interview question
มุมมอง 2.6Kปีที่แล้ว
Create useWhyDidYouUpdate() hook in React | React Machine Coding interview question
useCopy() hook in React | React Machine Coding Question - 52
มุมมอง 1.1Kปีที่แล้ว
useCopy() hook in React | React Machine Coding Question - 52
Circuit breaker in JavaScript | Atlassian interview question | Frontend interview question - 51
มุมมอง 6Kปีที่แล้ว
Circuit breaker in JavaScript | Atlassian interview question | Frontend interview question - 51
Create feature flag in React | Atlassian machine coding question
มุมมอง 6Kปีที่แล้ว
Create feature flag in React | Atlassian machine coding question
Get different object property value in each access | JavaScript Interview Question - 49
มุมมอง 1Kปีที่แล้ว
Get different object property value in each access | JavaScript Interview Question - 49
Restrict Object Mutation in JavaScript | JavaScript Interview Question - 48
มุมมอง 1.4Kปีที่แล้ว
Restrict Object Mutation in JavaScript | JavaScript Interview Question - 48
Infinite Scroll in React | Frontend Machine Coding Question | JavaScript Interview Question - 47
มุมมอง 9Kปีที่แล้ว
Infinite Scroll in React | Frontend Machine Coding Question | JavaScript Interview Question - 47
Create analytics SDK ( Swiggy) frontend interview question | JavaScript Interview Question - 46
มุมมอง 2.9Kปีที่แล้ว
Create analytics SDK ( Swiggy) frontend interview question | JavaScript Interview Question - 46
Switch-Case component in React | Atlassian's React Machine Coding Question - 45
มุมมอง 2.6Kปีที่แล้ว
Switch-Case component in React | Atlassian's React Machine Coding Question - 45
Auto suggestion in React | Machine coding question | JavaScript Interview Question - 44
มุมมอง 3.4Kปีที่แล้ว
Auto suggestion in React | Machine coding question | JavaScript Interview Question - 44
I think you shouldn't use any helper functions like reduce as they are not allowed in interviews most of the time.
This may be a cleaner solution class AnalyticsSdk { #queue = []; #analyticsFn; #waitInterval; #retriesCount; #sendingInProgress = false; constructor(sendAnalytics, waitInterval = 1000, retriesCount = 1) { this.#analyticsFn = sendAnalytics; this.#waitInterval = waitInterval; this.#retriesCount = retriesCount; } logEvent(event) { this.#queue.push(event); if (!this.#sendingInProgress) { console.log("Start the process of sending events"); this.#sendingInProgress = true; this.#send(); } } async #send() { const event = this.#queue.shift(); console.log( `Inside Send: Time: ${new Date().getSeconds()}, event: ${event}` ); let i = 0; while (i <= this.#retriesCount) { try { await this.#analyticsFn(event); break; } catch (_e) { console.log(`-----------------Error Sending: ${event}--------------`); i++; } } if (this.#queue.length > 0) { setTimeout(this.#send.bind(this), this.#waitInterval); } else { this.#sendingInProgress = false; } } } let counter = 0; function sendAnalytics(event) { return ++counter % 5 === 0 ? new Promise((resolve, reject) => { setTimeout(() => { console.log(`Error!!: ${event}`); reject(`Error!!: ${event}`); }, 500); }) : new Promise((resolve, reject) => { setTimeout(() => { console.log(`Success!!: ${event}`); resolve(`Success!!: ${event}`); }, 500); }); } const sdk = new AnalyticsSdk(sendAnalytics); sdk.logEvent("event 1"); sdk.logEvent("event 2"); sdk.logEvent("event 3"); sdk.logEvent("event 4"); setTimeout(() => { console.log("***********RESTART************"); sdk.logEvent("event 5"); sdk.logEvent("event 6"); sdk.logEvent("event 7"); sdk.logEvent("event 8"); sdk.logEvent("event 9"); sdk.logEvent("event 10"); }, 10000);
thank you
I got this question in a interview and I was able to code the js part not the css part. will learn it now.
I think its a bit misleading, 17:45 when state updates, it doesnt run cleanup function because the useEffect is with empty dependency array. The issue is initially canStart is false, and so slideMove fn before going in useEffect initial mount still holds false
In short, if you dont have that canStart in deps, cleanUp function will not be executed but slideMove doesnt get the updated canStart value but still holds false
Bit difficult to understand that how useEffect cleanup get's called during update with an empty dependency array.
WIth empty array the cleanup will be called on unmount only not on updates
Thank you ... Read more Read eloquent js 2:55 Javascript30.com 4:40 Read eloquent js again 5:34 Traversy media build 5 projects 5:55 Page life cycle 7:10 Critical Rendering path 7:49 Library/framework 9:25 1 to 2 projects using library/framework 12:20 Job hunt 13:20 Problem solving easy med 16:17 Sde 2 17:22 Advance js 17:59 Web.dev 19:27 Engineering blogs 21:40 Quality projects 23:06 Adv FE dev and med to hard 24:35
Hi Prashant Why are we using setTimeout here? Without that too, we could have done the throttling, no?
Yes, upto your implementation
Bhai espe video banana please Build a search bar with denouncing and throttling
The condition is not correct for circle. Two circles will intersect if the difference between their radius is smaller than the distance separating their centers : correct answer is : const distance = Math.sqrt( (x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2) ); if ( distance -r1 - r2 <= 0) { return true; } ;
Check the code yourself
This was a little difficult to understand
@@sumanthprabhu11 try to code it
Way too few people talk about this. And if you are a beginner and still learning react, debugging this can be frustrating as it's not as common bug. Thanks for the video!
Is this really asked for SDE1 role ? I am scared
@@mirage4731 no sde2
Hey I have taken your frontend system design course. I am not able to figure it out how to start. Like from which topics I have to start from that book. Can you please guide me , I am preparing first time for system design
Check the announcement thread, I have shared how to use the course
@@Learnersbucket sorry, where can I find that ? In that course ?
@@vishwas55 yes
thanks
do we have to do this in js or reactjs in interview??
@@shreyojitdas9333 Javascript is best, but it's upto you
@@Learnersbucket thank you sir for ur guidance
but this is specific to whole window what if we want to implement the same but in a component scrolling context
@@AnilPhiyak use that components ref
Your knowlege on frontend is impressive. I'm a huge fan of you, you are like arpit bhayni of frontend
3G+ ???? where do you live on Antarctica? because I got 5G in my hand in tier 3 city a year and half back
Thanks a lot sir, this was really inspiring 🙏🙏
*Last one is way Complex* !
😑😑😑
Within the else block, when there is a `lastRan`, why do you need to check if (Date.now() - lastRan >= delay) before calling the fn? Isn't that repetitive because we are already setting the delay with the new timeout (lastTimerid) with: delay - (Date.now() - lastRan)?
*****reduce solution***** function asyncTask() { const random = Math.floor(Math.random() * 10); console.log({ random }); return new Promise((resolve, reject) => { setTimeout(() => { if (random < 5) resolve(`resolved ${random}`); else reject(`rejected ${random}`); }, 1000 * random); }); } const task6 = () => asyncTask(); const task7 = () => asyncTask(); const task8 = () => asyncTask(); const task9 = () => asyncTask(); const task10 = () => asyncTask(); const asyncOperations = [task6, task7, task8, task9, task10]; function executeAsyncTasksUsingReduce(tasks, callback) { const resolvedTasks = []; const rejectedTasks = []; let count = 0; tasks.reduce((acc, curr, index, arr) => { return acc.finally(() => { return curr() .then((res) => resolvedTasks.push(res)) .catch((err) => rejectedTasks.push(err)) .finally(() => { count++; if (count === arr.length) callback(rejectedTasks, resolvedTasks); }); }); }, Promise.resolve()); } executeAsyncTasksUsingReduce(asyncOperations, (err, res) => console.log({ err, res }) ); ***** for-of solution ***** function asyncTask() { const random = Math.floor(Math.random() * 10); console.log({ random }); return new Promise((resolve, reject) => { setTimeout(() => { if (random < 5) resolve(`resolved ${random}`); else reject(`rejected ${random}`); }, 1000 * random); }); } const task1 = () => asyncTask(); const task2 = () => asyncTask(); const task3 = () => asyncTask(); const task4 = () => asyncTask(); const task5 = () => asyncTask(); const asyncOps = [task1, task2, task3, task4, task5]; async function executeAsyncTasksInSequence(tasks, callback) { const resolvedTasks = []; const rejectedTasks = []; for (let task of tasks) { console.log({ resolvedTasks, rejectedTasks }); try { const response = await task(); resolvedTasks.push(response); } catch (err) { rejectedTasks.push(err); } } callback(rejectedTasks, resolvedTasks); } executeAsyncTasksInSequence(asyncOps, (err, res) => console.log({ err, res }));
Can you please check my code and let me know whether this is correct or not. I still don't get why chop is needed, when we can just do slice in code? why to complicate it. const mapLimit = async (array, limit, iteratee) => { return new Promise((res, rej) => { let results = []; let idx = 0; async function next() { if (idx < array.length) { const subArray = array.slice(idx, idx + limit); const asyncCalls = subArray.map(async (value) => { return new Promise((resolve, reject) => { iteratee(value, (error, result) => { if (error) { rej(error); reject(error); } else { resolve(result); } }); }); }); const resultVals = await Promise.all(asyncCalls); results = results.concat(resultVals); idx += limit; next(); } else { res(results); } } next(); }); }; const asyncIterateeFunc = (val, callback) => { setTimeout(() => { const res = val * 2; callback(null, res); }, 1000); // 1 sec for each, if only 1000 and no random; }; const arr = [1, 2, 3, 4, 5]; mapLimit(arr, 2, asyncIterateeFunc) .then((res) => console.log("mapLimit: ", res)) .catch((err) => console.error("mapLimit: ", err));
Hi Prashant, Nice video. I think you have missed the `typeOf` keyword before checking for the type of second condition in line 11
Okay, will chech
Great video ! And naice images
I was asked this question in my phone screen meeting during an Amazon process. Luckily, I had a good understanding of recursion, and I could move to the final round.
Thats great
😭😭 kuchh samajh nhi aa rahaa, i think i am not able to make it
Thanks Prashant. Can you also make video on variations of this problem ? Ex - i) At one time only 3 progress bars can be active, if user clicked 4 times, 4 progress bar will start only once first three has been compled. ii) How to implement it without using setTimeout() That will be helpful.
The current solution handles it
Hii Prashant, Here's my solution for the same const obj = { a: { b: (a, b) => a+b, c: { e: (a, b, c) => a+b-c }, }, d: (a, b, c) => a - b - c, e: 1, f: null, g: "" } const calculate = (...args) => { const [obj, ...remaining] = args; return Object.entries(obj).reduce((acc, [key, value]) => { const type = typeof value; if(type === "function") { acc[key] = value(...remaining); }else if(value && type === "object" && !Array.isArray(value)) { acc[key] = calculate(value, ...remaining); }else { acc[key] = value; } return acc; }, {}); } const fn = (obj) => { return (...args) => { return calculate(obj, ...args); } } console.log(fn(obj)(1, 1, 1))
Good approach. However for me, using one dummy node without contents and observing it with IntersectionObserver works well over remembering this formula. whenever this dummy node is visible or intersection I load more data, and move this dummy node towards the end.