Monday, March 9, 2020

Wait Three Seconds!


An interesting piece of code from Java Script : Understanding the Weird Parts


//long running function
function waitthreeseconds(){
    var ms = 3000 + new Date().getTime();
    while (new Date() < ms){
        
    }
    console.log("Function Finished")
    }
waitthreeseconds();

No comments:

Post a Comment