JavaScript获取纳秒级时间戳:performance.now()方法详解
在JavaScript中,可以使用performance.now()方法获取纳秒级的时间戳。这个方法返回的是当前页面加载完成至今的毫秒数,精确到千分之一毫秒(即纳秒级)。以下是一个示例代码:
var timestamp = performance.now();
console.log(timestamp);
请注意,performance.now()返回的是浮点数,表示从性能测量开始到当前时间的毫秒数。
原文地址: https://www.cveoy.top/t/topic/nGh5 著作权归作者所有。请勿转载和采集!