zoukankan      html  css  js  c++  java
  • 循环for语句 if语句

    if语句:

          if(表达式){

             代码

    }else if(表达式){

            代码

    }

     for循环:

         for(var i=0; i<10; i++){

               alert(1); (弹窗)

    }

     

    if语句:

          if(表达式){

             代码

    }else if(表达式){

            代码

    }

     for循环:

         for(var i=0; i<10; i++){

               alert(1); (弹窗)

    }

     

    while循环:

    while(表达式){

         代码

    }

    使用场景

    For 次数确定的时候使用

    While 直到满足摸个条件的时候终止循环

    两个关键字:

        break    结束循环(终止)

         continue  跳过本次循环

                   for(var i=0; i<10; i++){

                      break ;或者 continue

    }

    注意:

    1.不是纯数字字符串转数字的时候 从左到右 第一个不是数字的为止:

      举例: parseInt(“123”) =》 123

                  parseInt(“12a3”) =》 12

                  parseInt(“a123”) =》 0

    2.迭代: 把0-100之间的数算出来

       穷举: 把0-100之间的数举出来

    3.如果纯数字字符串 除了加号 自动转成数字. (因为+号把字符串拼接起来了)

  • 相关阅读:
    Kubernetes中部署MySQL
    内置函数-format()
    Jenkins-deploymnt
    一次遇到too many open files的解决详情
    一次nginx问题记录
    kickstart自动化安装系统
    Maven —— 命令行清除编译打包
    CURL 发送POST请求
    mysql的my.cnf配置参考
    利用nginx实现生产和灰度环境流量切换
  • 原文地址:https://www.cnblogs.com/LQK157/p/10952828.html
Copyright © 2011-2022 走看看