欧美亚洲中文,在线国自产视频,欧洲一区在线观看视频,亚洲综合中文字幕在线观看

      1. <dfn id="rfwes"></dfn>
          <object id="rfwes"></object>
        1. 站長資訊網(wǎng)
          最全最豐富的資訊網(wǎng)站

          JavaScript怎么求等差數(shù)列

          JavaScript求等差數(shù)列的方法:1、創(chuàng)建一個js示例文件;2、通過“function print1(start, value, endKey) {…}”定義一個print1函數(shù);3、通過“for (let i = 0; i < endKey; i++) {arr.push(start + (i * value));}”實現(xiàn)等差數(shù)列的計算邏輯即可。

          JavaScript怎么求等差數(shù)列

          本教程操作環(huán)境:Windows10系統(tǒng)、javascript1.8.5版本、Dell G3電腦。

          JavaScript怎么求等差數(shù)列?

          js實現(xiàn)等差數(shù)列

          等差數(shù)列

          /**  * 等差數(shù)列  * start: 開始數(shù)字  * value: 差值  * endKey: 結束位置的key  */ function print1(start, value, endKey) {     let arr = [];     for (let i = 0; i < endKey; i++) {         arr.push(start + (i * value));     }     console.log(arr); } print1(1, 2, 10);
          登錄后復制

          JavaScript怎么求等差數(shù)列

          相關拓展:

          等差數(shù)列是指從第二項起,每一項與它的前一項的差等于同一個常數(shù)的一種數(shù)列,常用A、P表示。這個常數(shù)叫做等差數(shù)列的公差,公差常用字母d表示。

          例如:1,3,5,7,9……2n-1。通項公式為:an=a1+(n-1)*d。首項a1=1,公差d=2。前n項和公式為:Sn=a1*n+[n*(n-1)*d]/2或Sn=[n*(a1+an)]/2。注意:以上n均屬于正整數(shù)。

          JavaScript怎么求等差數(shù)列

          推薦學習:《JavaScript視頻教程》

          贊(0)
          分享到: 更多 (0)
          網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號