If an arrow function had one task to perform (E.g. add two inputs together), we could omit the curly braces and the
const add = (num1, num2) => num1 + num2 console.log(add(5, 10)); // 15
However, I was wondering what would happen if we didn’t omit the
const add = (num1, num2) => return num1 + num2; // Uncaught SyntaxError: expected expression, got keyword 'return'
It threw an error saying that it expected an expression. However, what I don’t understand is that we could’ve written a log statement, which is not an expression without getting an error
const add = (num1, num2) => console.log(num1 + num2); add(5, 10); // 15
How does this work?