Find elapsed time in javascript

前端 未结 9 578
死守一世寂寞
死守一世寂寞 2020-12-10 03:35

I\'m new to JavaScript and I\'m trying to write a code which calculates the time elapsed from the time a user logged in to the current time.

Here is my code:-

9条回答
  •  清歌不尽
    2020-12-10 04:22

    You can simply use performance.now()

    Example:

    start = performance.now();
    
    elapsedTime = performance.now() - start;
    

提交回复
热议问题