// rest parametar with spread method function getAges6(...age) { const total = age.reduce((n, c) => { return (n += c); }); console.log(total); } getAges6(12, 34, 54, 32, 23); // result :- 155