How to get the output from console.timeEnd() in JS Console?

后端 未结 4 2092
感情败类
感情败类 2021-01-31 07:50

I\'d like to be able to get the string returned from console.timeEnd(\'t\') in my Google Chrome Javascript Console.

In this example below, I\'d like one var

4条回答
  •  眼角桃花
    2021-01-31 08:23

    console.timeEnd() function puts the time to console, and returns the value so you can save it to variable

    var c = console.timeEnd('a');
    c/1000+'s';
    

    or you can save this variable to window object for latest usage

    window.c = console.timeEnd('b');
    window.c
    

提交回复
热议问题