Out of curiosity, why does writing console.log("hello")
inside console return undefined?
Is it for the same reasons in defining void function in C?
Out of curiosity, why does writing console.log("hello")
inside console return undefined?
Is it for the same reasons in defining void function in C?
The console.log just write a text and return with undefined. If you create a function, add a returning value, there will be not undefined, it will returns with the added value. Example:
function writer(){
console.log("write new line");
return "ok";
}
If you call the writer() that the output is "ok" in new line after "write new line".