当前位置:网站首页>Simple test JS code
Simple test JS code
2022-07-24 17:53:00 【Zero one_】
Copyright notice : Reprint please indicate the source https://blog.csdn.net/nk1212582/article/details/81321202
background
because JS The program cannot be like C++、Python Programs run separately , It is not conducive to testing the function of a piece of code
Purpose
A short test JS Code
step
(1) Create a new one test.html file
(2) stay test.html Write the following in the document
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>test</title>
<script type="text/javascript">
</script>
</head>
<body>
</body>
</html>(3) stay test.html Write what needs to be tested JS Code , as follows
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>test</title>
<script type="text/javascript">
function Student(name, age){
this.name = name;
this.age = age;
this.description = function(){
return this.name + " The age of :" + this.age;
}
}
var p4 = new Student("Tony", 28);
var p5 = new Student("Tom", 40);
console.log(p4.description()) // Output is :Tony The age of :28
console.log(p5.description()) // Output is :Tom The age of :40
</script>
</head>
<body>
</body>
</html>
(4) Open it in a browser test.html, Press F12, see console.log() The contents of the printout
边栏推荐
- Are the top ten securities companies safe and risky to open accounts?
- Just one dependency to give swagger a new skin, which is simple and cool!
- 0611~ self study class
- 0623~放假自习
- Get the data of Tongcheng (elong) Hotel
- Today, I met a 38K from Tencent, which let me see the ceiling of the foundation
- Is header file required? Follow the compilation process~~~
- PXE高效批量网络装机
- 《STL源码剖析》应该怎样读?
- OpenCV 图片旋转
猜你喜欢

Scept: consistent and strategy based trajectory prediction for planned scenarios

The ability to detect movement in vivo and build a safe and reliable payment level "face brushing" experience

Review and analysis of noodle dishes

邻接表的定义和存储以及有向图无向图的邻接存储

Section 7 Data Dictionary: hash followed by Daewoo redis ------- directory post

Getaverse,走向Web3的远方桥梁

分家后印象笔记过日子依然不好过,骚操作却不少

二维卷积——torch.nn.conv2d的使用

The results of the second quarter online moving people selection of "China Internet · moving 2022" were announced

Quickly complete the unit test junit4 setting of intelij idea
随机推荐
0613 ~ self study
Review and analysis of noodle dishes
C language programming training topics: K characters in left-handed string, little Lele and Euclidean, printing arrow pattern, civil servant interview, poplar matrix
The results of the second quarter online moving people selection of "China Internet · moving 2022" were announced
0615 ~ realize RBAC permission management with user-defined annotations
去不图床容量兑换
Array double pointer - deliberate practice
Use 4D nerf to display occlusion (cvpr2022)
Common methods of number and math classes
C语言中的字符与字符串库函数的使用以及模拟实现
还在从零开始搭建项目?这款升级版快速开发脚手架值得一试!
SSM framework learning
SV强制类型转换和常数
C language custom type explanation - structure
Opencv picture rotation
Definition and storage of adjacency table and adjacency storage of directed graph and undirected graph
简单测试JS代码
实习报告1——人脸三维重建方法
JS & TS learning summary
How to follow the "low coupling" design principle?