Let's assume the following functions:
javascriptconst a = () => { return } const b = () => { return undefined } const c = () => { return null }
If you execute them:
javascripta() // undefined b() // undefined c() // null
If you don't specify any parameters using a return
statement, you are returning an undefined
value. As null
is a specific (empty) value, it's different from undefined
.
Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.