Advertisement
zornitsa_zlateva

sumNums

Jan 23rd, 2022
768
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sumNums(n, m) {
  2.     let num1 = Number(n);
  3.     let num2 = Number(m);
  4.     let result = 0;
  5.     for (let i = num1; i <= num2; i++) {
  6.         result += i;
  7.     }
  8.     return result;
  9.     console.log(result);
  10. }
  11. sumNums('1','5');
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement