i need a different way of writing the addUpTo(n) function . which as a better performance or calculate faster than the function i have below
A JavaScript function that calculates the sum of all numbers from 1 up to (and including) some number n.
function addUpTo(n){
let total = 0;
for(let i =1; i<=n; i++){
total +=i;
}
return total;
}
need a faster way of writing this function which is far better than this