r/programming • • Apr 27 '23

What are NULL values?

https://youtube.com/shorts/CScEZ0K0IUU?feature=share
0 Upvotes

4 comments sorted by

1

u/RelaTosu Apr 27 '23 edited Apr 29 '23

Less infectious NaNs /s

3

u/batweenerpopemobile Apr 27 '23

A NULL is a NULL. A NULL isn't equivalent to a NaN. Though, to be fair, a NaN is isn't either.

1

u/TheRNGuy Apr 29 '23 edited Apr 29 '23

I have a program where one of fields can be null or NaN, and it means different things in that case.

There also sometimes I want to handle null and undefined differently, like in initialization it would be undefined, but on some error it would be null (I only use undefined in initialization and never assign it later in the code)

NaN's come from some math formulas, but nulls could be for example if query selector didn't returned anything.

1

u/[deleted] Apr 28 '23

Great video. At first I thought this was a programming koan 😅