Skip to content

Instantly share code, notes, and snippets.

@yschen25
Last active March 21, 2022 23:22

Revisions

  1. yschen25 renamed this gist Mar 21, 2022. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. yschen25 revised this gist Mar 21, 2022. No changes.
  3. yschen25 created this gist Mar 21, 2022.
    9 changes: 9 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    function listSum(n) {
    let result = 0; // Assign 數值給變數,執行 1 次

    for (let i = 0; i < n.length; i++) { // Loop array 執行 n 次
    result += n[i];
    }

    return result; // Return 結果,執行 1 次
    }