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>
相关推荐
小小测试开发2 小时前
安装 Python 3.10+
开发语言·人工智能·python
KaMeidebaby3 小时前
卡梅德生物技术快报|PD1 单克隆抗体定制配套 N 糖全谱质控开发
前端·人工智能·算法·数据挖掘·数据分析
wangruofeng3 小时前
iOS、Android、Flutter 2026 流行框架对比
前端框架·app
nuIl4 小时前
实现一个 Coding Agent(3):工具调用
前端·agent·cursor
nuIl4 小时前
实现一个 Coding Agent(4):ReAct 循环
前端·agent·cursor
AAA大运重卡何师傅(专跑国道)4 小时前
【无标题】
开发语言·c#
nuIl4 小时前
实现一个 Coding Agent(1):一次 LLM 调用
前端·agent·cursor
nuIl4 小时前
实现一个 Coding Agent(2):让 LLM 流式响应
前端·agent·cursor
copyer_xyf4 小时前
Python 异常处理
前端·后端·python
sugar__salt4 小时前
从栈队列数据结构到JS原型面向对象全解
前端·javascript·数据结构