当前位置:网站首页>How to view program running time (timer) in JS
How to view program running time (timer) in JS
2022-06-27 07:35:00 【I am the sun?】
We can add... At the beginning of the code to be tested :
console.time(“ Timer name ”);
Add at the end of the test code :
console.timeEnd(“ Timer name ”);
The following code :
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<script type="text/javascript">
console.time("test");
var sum = 0;
for(var i = 1;i <= 100;i++){
var flag = true;
if(i == 1)
flag = false;
for(var j = 2;j < i;j++){
if(i % j == 0){
flag = false;
break;
}
}
if(flag){
document.write(i + " ");
sum++;
}
}
document.write("<br /> Primes in all :" + sum + " individual .");
console.timeEnd("test");
</script>
</head>
<body>
</body>
</html>

边栏推荐
- File 与 MultipartFile概述
- 碎煤机crusher
- 正斜杠反斜杠的由来
- JDBC parameterized query example
- JS use switch to output whether the result is qualified
- PostgreSQL encounters permission denied in Windows system
- 攻防演习防御体系构建之第一篇之介绍和防守的四个阶段
- Stream常用操作以及原理探索
- Xiaomi Interviewer: let's talk about the proficient Registration Center for three days and three nights
- 2022 cisp-pte (II) SQL injection
猜你喜欢

MySQL

js求所有水仙花数

语音信号处理-概念(二):幅度谱(短时傅里叶变换谱/STFT spectrum)、梅尔谱(Mel spectrum)【语音的深度学习主要用幅度谱、梅尔谱】【用librosa或torchaudio提取】

js中输入三个值,并且由小到大输出

(已解决) MINet 进行测试时报错如下 raise NotImplementedError

Common operation and Principle Exploration of stream

基础知识 | js基础

Error in idea connection database

C# 请问怎么在更新数据库时候调用line与rows

Coggle 30 Days of ML 7月竞赛学习
随机推荐
语音信号处理-概念(一):时谱图(横轴:时间;纵轴:幅值)、频谱图(横轴:频率;纵轴:幅值)--傅里叶变换-->时频谱图【横轴:时间;纵轴:频率;颜色深浅:幅值】
数据库系统工程师对口专业有哪些?
Interviewer: how to never migrate data and avoid hot issues by using sub database and sub table?
R 语言并行计算 spearman 相关系数,加快共现网络(co- occurrence network)构建速度
oracle的similarity方法实现原理
MySQL
Interviewer: do you have any plan to request a lot of data that does not exist in redis to destroy the database?
突破从0到1后,鲜花电商2.0时代怎么走?
Vs how to configure opencv? 2022vs configuration opencv details (multiple pictures)
JDBC reads MySQL data list
js输出1-100之间所有的质数并求总个数
IDEA连接数据库报错
Park and unpark in unsafe
Xiaomi Interviewer: let's talk about the proficient Registration Center for three days and three nights
Speech signal processing - concept (II): amplitude spectrum (STFT spectrum), Mel spectrum [the deep learning of speech mainly uses amplitude spectrum and Mel spectrum] [extracted with librosa or torch
用XGBoost迭代读取数据集
JDBC操作Mysql示例
js打印99乘法表
(已解决) MINet 进行测试时报错如下 raise NotImplementedError
R language calculates Spearman correlation coefficient in parallel to speed up the construction of co occurrence network