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
-
jaeder4235710ybut if the values of true and false change, these would return those new values? xD -
sheeponmeth109010y@StefanH I don't know anything about JS, but is it possible that it's for when you want to pass a function as an argument, but you always want it to return true or false in a corner case? -
Treebasher29910yIn languages like C, it is good practice to typedef commonly used native types. For example, instead of using "unsigned long", I might typedef that to "ULONG" and prefer to use that as my data type.
The reason is for portability and to future-proof your code. If a native type doesn't use the same number of bits of memory on two different systems, or if a future compiler update somehow breaks previously-assumed truths about a native type, your whole program can easily be fixed by simply resolving the issue in the typedef.
I realize that jQuery is nowhere near on the level of something like C, and I also realize that booleans are a fairly simple "type" to process...but this smells similar to me. -
MariusGelez1910yThey are used for assignments that need a function. For example:
this.isDefaultPrevented = returnTrue;
isDefaultPrevented is a function so it needs a function that returns true as the default functionality. -
elazar101610yWhat wouldcyou say about 'function(x) { return x;}'? Looks even sillier, yet it isn't. -
FelisPhasma618310y@icemad bet they could always return 1, 0, pr and of the other bool equivalents
Related Rants

This never gets old...
Exactly
Found this code back in jQuery 1.9.1. Checked again, and t is still here in jQuery 3.1.0. Suppose it is just in case the values of true and false ever change 😃
undefined
javascript
☢
redundant
jquery
laugh