JS教程:循环语句

 时间:2024-10-14 01:57:04

1、while循环写法如下:基本上和c++写法相同var i = 0;while (++i <= 10 ){ console.log("i = " + i);}

JS教程:循环语句

3、for的另外一个用法c++是没有的。这个写法和python的写法比较像。function Test(){ this.name = "test"; this.num = 14; this.func = function(){ console.log("func") }}var test = new Test();for(keys in test){ console.log(test[keys])}

JS教程:循环语句

5、还用一种循环是用for .. of。这个倒是不常见。var str = "test";for (var s of str) { console.log(s);}

JS教程:循环语句
  • MySQL错误:Can't connect to(10060)
  • eclipse中新建STM32工程的方法
  • python模块tkinter没有属性tk怎么办
  • 如何实现点击div执行js函数
  • django怎样启动服务器怎样终止服务器
  • 热门搜索
    铁树果的功效与作用 高丽参的功效与作用 柚子的作用 河南有什么好玩的地方 胡柚的功效与作用 题目的作用 知识付费 乌鸡汤的功效与作用 山药的作用 苋菜的功效与作用