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怎样启动服务器怎样终止服务器
  • 热门搜索
    如何填报志愿 怎么取消qq手机绑定 怎么在excel中画线 iphone如何刷机 梦见火是什么意思 海琴手表怎么样 奇瑞qq3怎么样 sport是什么意思 bat是什么意思 普洱茶如何保存