相关疑难解决方法(0)

JavaScript - 循环比逐行离散写入更快吗?

忽略所有代码清洁度和可读性,哪个脚本会更快完成?

这个:

for(var i = 0; i < 10; i++){
  --do that thing--
}
Run Code Online (Sandbox Code Playgroud)

或这个:

--do that thing--
--do that thing--
--do that thing--
--do that thing--
--do that thing--
--do that thing--
--do that thing--
--do that thing--
--do that thing--
--do that thing--
Run Code Online (Sandbox Code Playgroud)

或者它们是相同的,性能方面的?

javascript performance loops readability

5
推荐指数
1
解决办法
909
查看次数

标签 统计

javascript ×1

loops ×1

performance ×1

readability ×1