Undefined in console

clearly defines a variable, why output undefined.

Mar.14,2021

clipboard.png


" < " is the content of the command return that you enter. Define a variable that does not have return information

.

for example, you execute the following two commands in the console:

const a = () => 1 // areturnundefined

a() // areturn11

declares that a variable will not return a value, and assigning a value to a variable will return the value itself


because the console attempts to print the result of an expression evaluation by default.
for example:

> 1 + 2
3
The

console tries to print the result of the expression evaluation 1x2 , so it displays 3

.

similarly, if you

> console.log(2)
2
undefined

first the result of the expression is: print 2 (note that it is not return 2 but print 2), and then the console tries to print the calculated (return) result of console.log (). It does not return any results, so it displays undefined

so, I don't have to explain this.

var x = 8
undefined
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1beb008-30d9e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1beb008-30d9e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?