Created
June 6, 2022 08:04
-
-
Save Kadreev/aa9cad7a24bc68ad91408ee00cc5ca1f to your computer and use it in GitHub Desktop.
Time the speed of functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let i = 0; | |
| console.time("While loop"); | |
| while (i < 100000) { | |
| i++; | |
| } | |
| console.timeEnd("While loop"); | |
| console.time("For loop"); | |
| for (i = 0; i < 100000; i++) { | |
| // For Loop | |
| } | |
| console.timeEnd("For loop"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment