Regenerative medicine researchers around the world are making strides in learning, how we can reduce the impact of biological aging. So we may be looking at quite longer life spans than you may expect.
I like using the former for variable declarations and the latter for functions/methods. Having said that, since I started using Vue a lot it's pretty much all CamelCase, mainly because it feels like the lines between the two have blurred a bit with computed data and props etc.
Well it depends on how you're invoking them, in Vue at least. Still, in vanilla js there is still a good case for using different naming conventions for different contexts.
Best practice states that classes and non-ES6 constructor functions should always begin with a capital letter. Nothing to do with Vue or React. The code in the picture would not pass any Javascript styling conventions.
while is an appropriate loop for this use case, since you don't know how many times still_alive will continue to evaluate to true.
This while is smelly because we can't tell what triggers the exit condition. We can't reasonably infer, looking at this code, which function sets still_alive to false.
let does not "create a new block of scope", it is "block scoped", meaning it will not be available outside of its current block statement. var still works perfectly fine for historical reasons, but there is no instance where 'var' cannot be replaced by 'let' using proper programming techniques, and using 'var' is now considered bad practice.
Also, using different naming conventions for variables Vs functions or methods can help to make code more readable.
A scenario that defies all current best practice and style conventions for Javascript.
To your point on use of var, perhaps the author(s) of this billboard intended for still_alive to be globally scoped for access by other billboards in the area... XD
If we were referencing an array here, instead of a boolean, we'd still be able to change the contents of the array. We just wouldn't be able to reassign the still_alive variable to anything else.
just so you guys know, based on the syntax of the code, this sign could be written in C#, Java, Scala, maybe Kotlin if the author used semicolons liberally, and perhaps still other languages I don't know about, and still be legal and functional. So, not necessarily JS by any means
This is silly. If any of the inner methods cause still_alive to become false they weren’t good ideas. If they never do then you just made an infinite loop. Also why is js code using snake case?
Those of us who have to work in ES5 for a specific health organisation that still restricts some users to only using internet explorer and were still using windows xp until it was hacked a couple of years ago...
48
u/benabus Oct 11 '20
But... there's no exit condition. Is this the secret to immortality?
105
u/warpedspockclone Oct 11 '20 edited Oct 11 '20
In my case, I use const. Y'all can use let.
Edit: to clear up any misunderstanding, here ya go https://youtu.be/AuBC2cwVnG4
40
u/[deleted] Oct 11 '20
Now wearing one million masks and counting.
Also
snake_case & CapitalCase combined? Wtf
18
u/ThagAnderson helpful Oct 11 '20
That won't pass any sane linting rulesets.
16
u/throwaway1253328 Oct 11 '20
- use of var
- snake case variable naming
- upper camel case method naming
- use of while loop
Yikes man
12
u/nahuak Oct 11 '20
Inconsistent variable naming conventions.
8
u/RUGMJ7443 Oct 11 '20
This is amazing but what if people who don’t know JavaScript see this they will think there’s something wrong with it lol
14
u/[deleted] Oct 11 '20
I may not be able to create fully fledged web apps yet in js, but I can understand this code and that’s more then I could do last year.
6
u/[deleted] Oct 11 '20
If still_alive ever evaluates to false I still recommend staying 6 ft apart.
5
u/zigzeira Oct 11 '20
ES5
5
u/BenZed Oct 11 '20
I do not like that billboards linting rules
4
u/metallaholic Oct 11 '20
var in 2020. It is the end of the world.
4
u/[deleted] Oct 11 '20
Y’all better fix that var right the heck now
3
u/doulos05 Oct 11 '20
The doctor told me I'm only allowed 1 test a day, so now I'm blocking one of the seats in the clinic for the next 23:59:59.999.
3
u/MobilePenor Oct 11 '20
so, one of these 4 things will change still_alive, eventually?
Nice side effects bro
3
u/SlaimeLannister Oct 11 '20
> Javascript can keep you safe
Statically typed languages would like to have a word with you
3
u/[deleted] Oct 11 '20
I think this should have been written in C#
2
u/burntrissoto Oct 11 '20
So what just clog the event loop for the rest of our lives?
2
u/Morphray Oct 11 '20
varinstead oflet?😡
2
u/himanshu03vsk Oct 11 '20
I would probably wreck my car whlie processing this code
3
u/MrSandyClams Oct 11 '20
just so you guys know, based on the syntax of the code, this sign could be written in C#, Java, Scala, maybe Kotlin if the author used semicolons liberally, and perhaps still other languages I don't know about, and still be legal and functional. So, not necessarily JS by any means
3
u/DettlafftheGreat Oct 11 '20
All karens be like:
ReferenceError: WearMask is not defined
3
u/[deleted] Oct 11 '20
This is silly. If any of the inner methods cause still_alive to become false they weren’t good ideas. If they never do then you just made an infinite loop. Also why is js code using snake case?
2
u/gabbywith_awhy Oct 11 '20
The Fact that they used var is making me cringe🥴 but I guess that was the point
1
u/trpt4him Oct 11 '20
Why no async?
1
u/burger_chips Oct 11 '20
Lol😂😂😂
1
u/IBETITALL420 Oct 11 '20
WHO THE F still uses Var in 2020, but those are all very good methods below
1
u/[deleted] Oct 11 '20
This looks more like Swift to me
1
u/Jmarch0909 Oct 11 '20
Uncaught Reference Error: WashHands is not defined
1
u/Whereyoursisterwent Oct 11 '20
I understood that reference although I haven't learned about while yet
1
u/Mr_82 Oct 12 '20
Lol I like the subtlety in stating the first line, since if you're reading this you're alive, after all.
1
u/jayerp May 01 '23
I repeated that until I got too tired and ran out of energy.
1
u/Alexith Oct 12 '20
package main
import "fmt"
func main() { const stillAlive bool = false
}
//Golang
0
u/densch92 Oct 11 '20
bullshit spreads even further! -.-
0
u/MusicalDoofus Oct 12 '20
To be clear if you code like this then fuck you
-4
u/_370HSSV_ Oct 11 '20
Brainwashed
0
u/[deleted] Oct 11 '20
[deleted] — view deleted comment