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

Показать описание
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?
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?
Комментарии