learningToCode321456
New Coder
Hey!
I'm learning JS by myself, and I've found a piece of code i'm not able to understand [may seem easy for you, but i'm a beginner 🙂]
Why does the following code display '0' in the console?
Thx for your help!!
I'm learning JS by myself, and I've found a piece of code i'm not able to understand [may seem easy for you, but i'm a beginner 🙂]
Why does the following code display '0' in the console?
JavaScript:
const sum = (...args) => {
return args.reduce((a, b) => a + b, 0);
}
console.log(sum());
Thx for your help!!