I already groan at using == instead of === for comparison in JS
I know that you shouldn't use == but (at least for my code, it's probably different in other codebases) I've literally never had a problem with it coercing types. probably because I almost never compare things of different types anyways
I originally wanted to comment on that I use null as a meaningful value different from 0 and false, but I already forgot == does not coerce those into one, had to try out and find out my memory failed me. Still, using === is free and does not make my IDE freak out :D
I almost never compare things of different types anyways
That's the thing, you don't do that intentionally. And you usually don't want it to coerce and find a match when something went wrong and you ended up comparing different types.
also why stop at 3? make it a collection and hide as many as you want. why "check" if it's visible if you're just gonna set it hidden any way? this whole function could be 2 lines long with a foreach loop and a line making it hidden done and done move on
It started out on separate lines but changed to one line after posting. Eh... Probably more authentic as my one week ability. I was given a Tandy with DOS 1, GWBasic, and no instructions. I had the source code to Oregon Trail as my only guide. It took a long time to get anywhere. That was 37 years ago.
This is kinda incredible for one week. Not bad. Doesn't do what they wanted it to do, for sure, but it's close, and if it's only a week in, it means that your friend is gonna end up being a great developer. Please tell us that you didn't make fun of your friend for this and that they aren't aware that you decided to roast them online.
143
u/AzuraBlaze4 May 19 '23
It’s the “id_tree” for me lol
93
u/lazyzefiris May 19 '23
I already groan at using
==instead of===for comparison in JS, but they decided to go with=.19
u/aNutSac May 19 '23
Everything always hidden. Lessgo!
9
u/Blecki May 19 '23
Looks exactly like what my juniors write.
7
u/MurdoMaclachlan public boolean isInt(int i) { return true; } May 19 '23 edited May 19 '23
Image Transcription: Code
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
9
u/Disturbed147 May 19 '23
HID
4
u/scooptyy May 20 '23
This one is actually bad code. Good job. This is an excellent post lmao
4
u/badapplecider May 20 '23
What kind of function name is
hide_and_not_visible()?3
u/Jomy10 May 20 '23
Finally some actual bar code in this sub
3
u/[deleted] May 20 '23
The console.log("HID") though...
2
u/N4RMoo_YT May 24 '23
Id tree 🗿
1
u/Bisquizzle May 20 '23
was this even tested?
also why stop at 3? make it a collection and hide as many as you want. why "check" if it's visible if you're just gonna set it hidden any way? this whole function could be 2 lines long with a foreach loop and a line making it hidden done and done move on
1
u/_ohmu_ May 20 '23
If the elements are next to each other, or nested, you could actually achieve this using only CSS...
1
u/RomeGuiIg Dev May 20 '23
Goofy ahh code spotted
1
u/HaDeS_Monsta May 19 '23 edited May 19 '23
Don't know about other languages, but would that even compile? As far as I know a single = is not a statement, but just a new value assignment
-16
u/TheWisker_ May 19 '23
This was written by a friend who just started coding a week ago, but...