<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ![](https://img.kancloud.cn/74/49/7449dc533696128a25555a676c37931e_1068x545.png) 1. ~~~ /* * 編程語言中最常用的判斷:if、else if、else */ let x = 10; if (x) { // 條件(驗證真假的過程): // x==10 x===10 x>10 x<10 x>=10 ... // x 把當前值轉換為布爾類型驗證真假 // x>=0 && x<=10 或者 x==1 || x==2 // .... x++; } else { // 以上條件都不成立,執行else x--; } console.log(x); let x = '10'; if (x == 1) { x += 1; } else if (x == 5) { x += 2; } else if (x == 10) { //=>'10'==10 把字符串轉換為數字 條件成立 x += 3; // x = x + 3 => '103'//字符串拼接 } else { x += 4; } console.log(x); ~~~ 2. ~~~ // 三元運算符:處理最簡單的 if \ else 情況的 // 條件?成立處理的事情:不成立做的事情; // let x = 10; if (x>=10) { x++; } else { x--; } x >= 10 ? x++ : x--; console.log(x); // 在條件成立或者不成立的時候,如果不想做一些事情,則使用null/undefined等來占位即可;不占位會報錯; let x = 10; if (x == 10) { x++; } let x = 10; x == 10 ? x++ : null; // 如果需要做多件事情,則用小括號包起來,每一件事情中間用逗號分隔即可 // let x = 10; if (x > 0) { x++; console.log(x); } x > 0 ? (x++, console.log(x)) : null; //用逗號分割 // 可以根據需求完成三元運算符的嵌套 let x = 10; if (x > 0) { if (x < 10) { x++; } else { x--; } } else { x--; } x > 0 ? (x < 10 ? x++ : x--) : x--; ~~~ 3. ~~~ // 一個變量在不同值情況下的不同操作,我們可以改寫為 switch case 判斷(他只能應用于等于什么值做什么事情,不能用戶大于或者小于啥值做啥) let x = '10'; if (x == 1) { x += 1; } else if (x == 5) { x += 2; } else if (x == 10) { // 條件成立 x += 3; } else { x += 4; } console.log(x); =>'103' let x = '10'; switch (x) { case 1: //=>在x等于1的情況下做什么 x += 1; break; //=>每一種情況結束都要設置break(以供當此條件成立并處理完事情后,通知代碼不在向下執行) case 5: x += 2; break; case 10: //=>'10'===10 FALSE x += 3; break; default: //=>等價于else,而且最后一個判斷結束無需設置break x += 4; } console.log(x); //=>'104' 每一種case情況都是基于 === 進行比較的(嚴格比較,需要保證數據類型的一致) ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看