I have the following code:
console.log(doSomething);
doSomething();
function doSomething() {
console.log("Declare something");
}
which in the console returns
[Function: doSomething]
Declare something
But when I write
console.log(doSomething());
function doSomething() {
console.log("Declare something");
}
the console says
Declare something
undefined
I understand why it just says "Declare something" and not "[Function: doSomething]", but why does it say "undefined"? Why does it not say "Declare something Declare something"?