Grubhub Interview Question

Create a version of SetInterval with SetTimeout

Interview Answer

Anonymous

Jul 13, 2018

let timer = function(fn, delay) => { let context = this; let args = arguments; clearTimeout(timer) timer = setTimeout(fn.call(context, args), delay); };