JavaScript 循环分支语句-while循环

如果没有自身改变,就会一直循环下去

n=0,只要n小于10就输出hello,和n的值,并且每次加1,直到n大于等于10,才结束

html 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var n = 0;
        while (n<10){
            console.log("hello",n)
            n++
        }

    </script>
</body>
</html>
相关推荐
ly76898 小时前
HTML5 从入门到工程实践:语义化、表单、多媒体、性能与项目规范详解
前端·html·html5
m0_380743878 小时前
为 OpenAI 兼容接口配置教程
开发语言·python·node.js
万邦科技Lafite9 小时前
阿里巴巴拍立淘按图搜索商品API返回值实践:提升用户购物满意度的关键措施
开发语言·api·开放api·电商开放平台·京东开放平台
小小龙学IT10 小时前
Qt 6 跨平台开发完全指南:从信号槽机制到实际项目落地
开发语言·qt
leisoo809710 小时前
ig50数据落盘ClickHousevsTimescaleDBvsDuckDB实测对比 IG50免费开源股票数据API接口
开发语言·jvm·数据库·python·json
敢敢のwings11 小时前
智元 GO-2 与 AgiBot-World 深度解读
开发语言·后端·golang
yaoxin52112311 小时前
503. Java 反射 - 编写 ServiceFactory 类
java·开发语言·python
一个帅气昵称啊11 小时前
.Net C# AI智能体开发-快速开始
开发语言·c#·.net