JavaScript Interview Question: Build the setInterval() function - web boss

preview_player
Показать описание
Kindly subscribe to support this YouTube channel🙏

Timestamps are after the description

So I had this #JavaScript #interview some weeks ago where I was asked to build the setInterval() function that ships with JavaScript. While I didn't get the solution on the call, I took another shot at it after the interview and it wasn't that difficult after all - my initial issue was that I had to work with Objects and prototypes which isn't my forte when it comes to JavaScript.

After figuring out the solution, I decided to make a video about it. Even if you won't be asked to build the setInterval in your next interview, you definitely will see things like recursion, Objects, prototypes, and other JavaScript concepts you are probably scared of in real life in action.

00:00 Introduction
00:55 JSBin Overview
01:07 Seeing how the native JavaScript setInterval() works
01:58 Build the custom SetInterval function
02:40 Reviewing instructions from the interview question
03:00 Implementing the solution with a one time run
03:14 Testing the proposed one time run solution
03:54 Thinking of a way to continuously run the function
04:22 Using recursion to continuously run function
05:22 A quick note on how Object methods and prototypes in JavaScript
06:09 Running the SetInterval function created
06:25 Stopping the SetInterval function from running (A.K.A clearInterval)
07:14 Testing the clear method to see if it stops the function from running
08:28 What do you think?

Рекомендации по теме
Комментарии
Автор

Bruh, found this on Reddit and love what you're doing. Awesome that you're following up on a difficult interview with a clear explanation.

Coupla tips:
1. audio - had to crank my speaker from 10% to 80% to hear you clearly. Maybe holding the mic closer to your mouth could fix it? Or cranking up the audio track in your video editor?

2. psuedocode - it's easy enough to follow along with the video, but it'd be even easier if you did a psuedocode walkthrough to explain the process before coding it out. Would help a lot to understand the logic before diving into the code syntax, especially for beginners trying to learn both.

3. Github! - get this shiz posted online for the world to see! Just make a repo called "coding challenges" and load them there. Good practice to maintain a README with descriptions and links to the video tutorials on YouTube, too.

Keep beenin' a boss, web boss! Looking forward to more content!

**EDIT** Just saw the "Think my audio can be better" in the description and made a contribution. Looking forward to the upgrade!

berniegreen