You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
logger.measure should return a similar function, that takes a timestamp before and after invoking the original function, printing the time (colorfully) it took to run
EXAMPLE:
functionmeasureFunction(fn){returnfunction(){conststart=performance.now();constresult=fn.call(this,arguments);conststop=performance.now();console.log(''+fn.name+'(...) took '+(stop-start)+'ms to run');returnresult;};}functionstringifyAndUndo(obj){letobjAsString=JSON.stringify(obj);letbackToObj=JSON.parse(objAsString);returnbackToObj;}constmeasuredFunction=measureFunction(stringifyAndUndo);constresult=measuredFunction({hello: 'world',travelTo: 'mars'});
The text was updated successfully, but these errors were encountered:
logger.measure
should return a similar function, that takes a timestamp before and after invoking the original function, printing the time (colorfully) it took to runEXAMPLE:
The text was updated successfully, but these errors were encountered: