Skip to content

Instantly share code, notes, and snippets.

@Kadreev
Created June 6, 2022 08:04
Show Gist options
  • Select an option

  • Save Kadreev/aa9cad7a24bc68ad91408ee00cc5ca1f to your computer and use it in GitHub Desktop.

Select an option

Save Kadreev/aa9cad7a24bc68ad91408ee00cc5ca1f to your computer and use it in GitHub Desktop.
Time the speed of functions
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