Why the function is returning undefined in console?

Table of contents

The console is basically a CLI in our browser that can execute snippets of code.
console is basically an object, it is a property of a window object and it is accessed with window.console or console.

Function: When we declare a function. we tell it to return something or to do a console. That is what it is exactly doing After we declared a function, It evaluates the function, and the console.log returns nothing. It is returned as undefined.

Example:

The console.log is also a function, when you use a console.log it will return undefined.

Example:

.:. the Function is returning undefined after it is declared.