const func1 = (x) => x * 2;
const func2 = (x) => {
x = x * 3;
x = x + 1;
}
const y = func1(5);
const z = func2(2);
console.log(y + z); // ??
What will the console output be?
The second arrow function has more than one expression written in it, so it uses a syntax with curly brackets. To return a value, there must be a return, but it is missing.
A function that does not have a return always automatically returns undefined.
It turned out: 10 + undefined, which was eventually calculated in NaN.