13
u/TylerBreau Sep 25 '26
if !toiletRoll:
reloadTioletRoll();Janitor: Reload? Reload it on to what?
4
9
u/golfstreamer Sep 25 '26
Isn't this a bad description? "Non zero value", 0, null are all potential values of objects. Correct me if I'm wrong but I thought "undefined" usually refers to behavior. Like the programming language standard doesn't specify what should happen in this scenario. Is there a situation where an object is "undefined"?
10
u/AbyssWankerArtorias Sep 25 '26
Really just depends on the data you're dealing with. I think this meme makes sense in some context.
Non zero value: there is some toilet paper left on the roll
0: there is no toilet paper left on the roll:
Null: the place in which a toilet paper roll is supposed to be contains no roll. Practically speaking this equates to 0 toilet paper, but, there are many cases where you wouldn't equate the two depending on both the point itself and your intention with it.
Undefined: the place in which the toilet paper roll is supposed to be placed does not exist and therefore cannot be logically displayed as a value. Like trying to return the value of a variable that doesn't exist.
I see arguments for saying this isn't a good meme and for the meme itself. Just depends on the context.
4
u/TylerBreau Sep 26 '26
OP is referring to JavaScript. It has all 4 states.
Undefined is exactly it says it is. The thing you are accessing is literally not defined.
var myobj;3
u/golfstreamer Sep 26 '26
Ah thank you for your help.
1
u/Yoshalina Sep 26 '26
it is possible to intentionally assign it with the
undefinedliteral though, too.2
u/TylerBreau Sep 26 '26
Before ECMAScript 5 you could also assign undefined.
1
u/Yoshalina Sep 26 '26
this is still possible.
let meow = undefined;2
1
u/RedAndBlack1832 Sep 27 '26
You can refer to data being undefined as well. Usually this means declaring an object but not assigning it a value at time of creation, nor does it assign itself a default value. You shouldn't try to read undefined data though, and you certainly shouldn't make decisions based on it.
1
u/ThatSmartIdiot Sep 27 '26
undefined behaviour because it accesses undefined data because the value in that data's address is independent of that data's program's current runtime, so in a sense it's not far off?
4
3
u/Cant-Think-Of Sep 26 '26
What about negative values?
1
u/ThatSmartIdiot Sep 27 '26
those fall under the non-zero values criterion, though if it's an unsigned type it'll just be a big-ass number
2
1

69
u/MilkImpossible4192 Sep 25 '26
null is an object, 0 is a number, undefined is an undefined