console.log()
is a function. A function must always return some value to the caller. It's a ground rule.
If a return value is not specified, then the function will return undefined*.*
For example, see the below code.
function addOneTo(a) {
const result = a + 1;
return result;
}
addOneTo(2);
So, addOneTo
the function will return 3 in the console by adding 2+1.
But, if we remove the return statement, it will return undefined.
If you liked my content, connect with me. ๐
ย