Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
0 = value is explicitly set
null = there is no value
undefined = you're working in a terrible language and should switch ASAP -
@tosensei just say it (javascript).🤣. But if there will be no javascript developers then there will be no websites 😏 and no money
-
C0D4681383y@nullcoffee there was a world of browser interaction before Javascript took the lead role.
Vbscript could have taken off.
actionscript could have survived.
But, here we are. -
@C0D4 @tosensei @nullcoffee
https://typescriptlang.org/docs/...
... and if it's not bad enough, there are ways to make it worse.
Technically, one should start with boolean logic.
true | false
But we have a lil unpleasant problem here - what if we don't know the value?
Enter 3VL / 3 value logic / ternary system:
true | false | unknown
Note that unknown is special, easiest example is SQL where NULL = unknown ...
Comparison against unknown - unknown.
Note that logic operation like unknown and false is false, unknown or true is true.
Now what some languages do for the sake of Cthulhu in my opinion is to add a 4th dimension...
In JavaScript this is done exceptionally brain damaged.
Null is falsy if coerced to a boolean.
And undefined exists additionally....
So JS is an entirely different logical concept.
null == null - true
null == undefined - true
null == false - false
But
const value = null
if value { "Nope" } else { "Yep" }
(falsy if coerced to a boolean)
TLDR: JS has a completely broken logic regarding null values and added additionally undefined to differentiate between an "uninitialized" variable vs a variable with no value (null). -
Voxera115853y@C0D4 well vbscript was never really a thing since MS of the time did not let the browser grow.
Actionscript was never natively supported since it was a plugin and not universally available and flash was do abused even by “legitimate “ users that it deserved to die ;)
And js was the thing before either vbscript or actionscript.
And there was also jscript which was a lot more powerful than vbscript and also worked in IE.
But js was always the one you had to use for anything but internal sites. -
@nullcoffee there was a time before javascript, and there will be a GLORIOUS time after javascript.
maybe blazor will set us free.
also, another way to understanding:
0 = your toilet paper roll is empty.
null = you don't even _have_ a toilet paper roll.
undefined = you're sitting on the kitchen sink. get off of there. and then get out of my kitchen, you weirdo. (great, now the tap is dripping...) -
Voxera115853y@tosensei web assembly is the technology powering blazor and all other languages.
Js will most likely stay as the native lang but with webassembly more and more other languages will be useful. -
Crost41083y0 - value
Null - the value is that there is nothing. Null is a value.
Undefined - we don't know
My understand of null
0,empty = values explicitly set
Null = variable exists but it's still virgin.
Undefined = variable doesnot exists
devrant