当前位置:网站首页>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>
运行结果:
边栏推荐
- 云服务器配置ftp、企业官网、数据库等方法
- Use uview to enable tabbar to display the corresponding number of tabbars according to permissions
- Interviewer: how to never migrate data and avoid hot issues by using sub database and sub table?
- [openairinterface5g] rrcsetupcomplete for RRC NR resolution
- ggplot2的自定义调色板
- VNC Viewer方式的远程连接树莓派
- 仙人掌之歌——投石问路(1)
- uview的安装和功能
- Bean copy details
- Construction of defense system for attack and defense exercises part II common strategies for responding to attacks
猜你喜欢

Talk about Domain Driven Design

volatile 和 synchronized 到底啥区别?

Classical cryptosystem -- substitution and replacement

Yolov6's fast and accurate target detection framework is open source

Configuring FTP, enterprise official website, database and other methods for ECS

The interviewer of a large front-line factory asked: do you really understand e-commerce order development?

Process termination (have you really learned recursion? Test your recursion Foundation)

Gérer 1000 serveurs par personne? Cet outil d'automatisation o & M doit être maîtrisé

MySQL

js中判断奇偶的函数,求圆面积的函数
随机推荐
vs怎么配置OpenCV?2022vs配置OpenCV详解(多图)
postgreSQL在windows系统遇到权限否认(permission denied)
使用 Blackbox Exporter 测试网络连通性
Visual Studio VS 快捷键使用大全
Unsafe中的park和unpark
请问如何在网页通过excel文件的形式向后段数据库添加数据
sql sever列名或所提供值的数目与表定义不匹配
Winow10 installation nexus nexus-3.20.1-01
R language calculates Spearman correlation coefficient in parallel to speed up the construction of co occurrence network
云服务器配置ftp、企业官网、数据库等方法
Interviewer: do you have any plan to request a lot of data that does not exist in redis to destroy the database?
Origin of forward slash and backslash
pytorch Default process group is not initialized
[leetcode] day90 the element with the smallest K in the binary search tree
guava 教程收集一些案例慢慢写 google工具类
语音信号处理-概念(一):时谱图(横轴:时间;纵轴:幅值)、频谱图(横轴:频率;纵轴:幅值)--傅里叶变换-->时频谱图【横轴:时间;纵轴:频率;颜色深浅:幅值】
Date database date strings are converted to and from each other
R 中的 RNA-Seq 数据分析 - 调查数据中的差异表达基因!
OpenCV怎么下载?OpenCV下载后怎么配置?
一个人管理1000台服务器?这款自动化运维工具一定要掌握