I am back with new chapter, a new weridness.
Programming is usually taught by Examples!
- Niklaus Wirth (creator of the **PASCAL **Language)
Normally, we use to follow the principle technique of development as
👉 UI/UX Design
👉 HTML / CSS Development
👉 JS with Test case Developement
👉 All Good -> We are good to deliver ✔️ .
🤪 Not exactly same but something like this.
After 2 days: page taking long time to load.
OMG!😨😨 What happened?
Till yesterday everything was okay.😨😯
Jhon investigating that and he found there are 2 functions in code and one of the function taking long time to execute.
But he also struck❓❓
How to find which function is taking long time to execute?
According MDN Web Docs there is
- Start the timer by writing
console.time('some-label')with some label.
console.timeLog('label for start timer')will logs the current value of timer.
console.timeEnd('label for stop timer')will stop the timer and logs the time particular execution runs.
Just implement like below and get your leaky function. Cheers!!
console.time("answer time"); // answer timer alert("Click to continue"); console.timeLog("answer time"); alert("Do a bunch of other stuff..."); console.timeEnd("answer time");
This way Jhon can check the which function taking how much time for executing the respective task and Jhon resolved the issue.
Till then take care.
Top comments (1)
Stay tune for more such updates