Menu

gitpiper

sumN javascript Code Snippet in 2025

mathbeginner

Last Updated: 1 February 2025

Sums all the numbers between 1 and n.

  • Use the formula (n * (n + 1)) / 2 to get the sum of all the numbers between 1 and n.
const sumN = n => (n * (n + 1)) / 2;
sumN(100); // 5050

javascript snippet similar to sumN For You in February 2025

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️

© 2025 GitPiper. All rights reserved

Rackpiper Technology Inc

Company

About UsBlogContact

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️