📜  估计阅读时间计算器 - 任何代码示例

📅  最后修改于: 2022-03-11 14:55:13.531000             🧑  作者: Mango

代码示例1
function readingTime() {
  const text = document.getElementById("article").innerText;
  const wpm = 225;
  const words = text.trim().split(/\s+/).length;
  const time = Math.ceil(words / wpm);
  document.getElementById("time").innerText = time;
}
readingTime();Code language: JavaScript (javascript)