当前位置:网站首页>js输出形状
js输出形状
2022-06-27 07:20:00 【I am the sun?】
js输出5*5的星星矩形
<!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">
for(var i = 1;i <= 5;i++){
for(var j = 1;j <= 5;j++){
document.write("*");
}
document.write("<br />");
}
</script>
</head>
<body>
</body>
</html>
运行结果:
js输出正直角三角形
<!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">
// for(var i = 1;i <= 5;i++){
// for(var j = 1;j <= 5;j++){
// document.write("*");
// }
// document.write("<br />");
// }
for(var i = 1;i <= 5;i++){
for(var j = 1;j <= i;j++){
document.write("*");
}
document.write("<br />");
}
</script>
</head>
<body>
</body>
</html>
运行结果:
js输出倒直角三角形
<!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">
//类型一:矩形
/*
for(var i = 1;i <= 5;i++){
for(var j = 1;j <= 5;j++){
document.write("*");
}
document.write("<br />");
}
*/
//类型二:正直角三角形
/*
for(var i = 1;i <= 5;i++){
for(var j = 1;j <= i;j++){
document.write("*");
}
document.write("<br />");
}
*/
//类型三:倒直角三角形
for(var i = 1;i <= 5;i++){
for(var j = 5;j >= i;j--){
document.write("*");
}
document.write("<br />");
}
</script>
</head>
<body>
</body>
</html>
运行结果:
边栏推荐
- 内存屏障今生之Store Buffer, Invalid Queue
- 将通讯录功能设置为数据库维护,增加用户名和密码
- [Kevin's third play in a row] is rust really slower than C? Further analyze queen micro assessment
- One person manages 1000 servers? This automatic operation and maintenance tool must be mastered
- tracepoint
- (已解决) MINet 进行测试时报错如下 raise NotImplementedError
- Coggle 30 Days of ML 7月竞赛学习
- JDBC参数化查询示例
- 如何优雅的写 Controller 层代码?
- Unsafe中的park和unpark
猜你喜欢
Machine learning
Interviewer: do you have any plan to request a lot of data that does not exist in redis to destroy the database?
win10远程连接云服务器
磁选机是什么?
Oppo interview sorting, real eight part essay, abusing the interviewer
Configuring FTP, enterprise official website, database and other methods for ECS
OpenCV怎么下载?OpenCV下载后怎么配置?
【Kevin三连弹之三】Rust真的比C慢吗?进一步分析queen微测评
File 与 MultipartFile概述
面试官:请你介绍一下缓存穿透、缓存空值、缓存雪崩、缓存击穿的,通俗易懂
随机推荐
内存屏障今生之Store Buffer, Invalid Queue
云服务器配置ftp、企业官网、数据库等方法
JDBC读取Mysql数据列表
1-4 decimal representation and conversion
How torch. gather works
POI replacing text and pictures in docx
剑指 Offer 07. 重建二叉树
Self test in the second week of major 4
磁选机是什么?
Vs how to configure opencv? 2022vs configuration opencv details (multiple pictures)
【编译原理】山东大学编译原理复习提纲
Delay queue `delayqueue`
程序人生 - 程序员三十五岁瓶颈你怎么看?
What is the difference between volatile and synchronized?
pytorch Default process group is not initialized
R 语言Analyzing wine data
Multi table associated query -- 07 -- hash join
Difference between boundvalueops and opsforvalue
Centos7.9 install MySQL 5.7 and set startup
Configuring FTP, enterprise official website, database and other methods for ECS