Last active
March 21, 2022 13:03
-
-
Save imtrinity94/649bcb80ee654c30e574b1dabe89f854 to your computer and use it in GitHub Desktop.
This file contains 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
// To test a function and get back its return | |
function printElapsedTime(fTest) { | |
var StartTime = Date.now(), | |
vReturn = fTest(), | |
EndTime = Date.now(), | |
difference = EndTime-StartTime | |
System.log("Elapsed time: "+difference+" milliseconds") //5001 milliseconds | |
return vReturn | |
} | |
var yourFunctionReturn = printElapsedTime(sort) | |
function sort(){ // your function | |
const array1 = [1, 30, 4, 21, 100000]; | |
array1.sort(); | |
System.log(array1); | |
System.sleep(5000) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment