I would like to share my front end role phone interview experience here.
Background:
Status: 4yr work exp working in a financial company as full stack engineer
Position: SDE - Front end
Location: NYC
Date: April 20, 2020
Technical phone screen (1 hour):
The interviewer jumped directly to the question in the begining of the call. He mentioned since my resume has mostly web based projects, so he'll ask me a javascript related question. It was a question I've never seen on LeetCode.
Question: Give you a method expensiveFunction, which is really heavy and we don't want to call it often; and another param timeInterval, which indicates how long we are allowed to call it again. Write a wrapper function called throttle to implement this machanism.
For example: timeInterval = 500 (milliseconds)
var throttleFunc = throttle(expensiveFunction, 500);
throttleFunc(); // expensiveFunction called
throttleFunc(); // do nothing
throttleFunc(); // do nothing
.... // 500ms passed
throttleFunc(); // expensiveFunction calledI solved it using the javascript closure, with some hint from the interviewer, who is really nice.
Follow-up:
What if the expensiveFunction has parameters? What if the number of parameters are unknown?
In the end there's some time left so I asked some culture related questions.
One thing that helps is come up with a lot lot lot examples, and communicate with the interviewer. Hope this helps!