Skip to content

Instantly share code, notes, and snippets.

@matinkaboli
Created September 21, 2017 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matinkaboli/3298b5768eaaefde4b6658fc0e0b7924 to your computer and use it in GitHub Desktop.
Save matinkaboli/3298b5768eaaefde4b6658fc0e0b7924 to your computer and use it in GitHub Desktop.
let arrSq = [];
let arrSum = [];
for (let i = 1; i <= 100; i++) {
arrSq.push(i * i);
}
for (let i = 0; i <= 100; i++) {
arrSum.push(i);
}
arrSum = arrSum.reduce((a, b) => a + b);
arrSum *= arrSum;
arrSq = arrSq.reduce((a, b) => a + b);
console.log(arrSum - arrSq);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment