DEV Community

Discussion on: What’s your alternative solution? Challenge #7

Collapse
 
hayashiay profile image
hayashi-ay
const calcSumOfOdd = ( start, end ) => {
    return ( start + end ) * ( ( end - start ) / 2 + 1 ) / 2;
};

console.log( calcSumOfOdd( 11, 29 ) );