Difference between returning nothing, undefined, or null

Let's assume the following functions:

javascript
const a = () => { return }
const b = () => { return undefined }
const c = () => { return null }

If you execute them:

javascript
a() // 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.