this post was submitted on 26 Feb 2024
-16 points (21.4% liked)
Programming
17270 readers
39 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
If you actually knew how to program both Java and JavaScript (originally called Mocha btw), you would know that they are very different languages. Saying that JS was intended to have a similar syntax to Java is like saying Java was intended to have a similar syntax to C. They're both true, but it doesn't really mean anything.
Frankly one can learn any imperative language once one learns one. It's the standard library of a language and the quirks of the library that is the real challenge .The syntx of the language doesn't boggle anyone.
These two code blocks don't use standard libraries (aside printing output) and have nothing in common. Even output is totally different, since at the time JavaScript did not support text output at all (there was no browser console). They are as close as you can possibly get between the two languages (they're not really close at all, because in the 90's it wasn't possible to define "real" classes in JavaScript, and to this day it's not possible for a function to have instance variables in Java).
And as someone who's been writing JavaScript professionally for 20 years... I assure you it's full of quirks that still confuse the heck out of me at times. I mean just last week I had a problem with variable scope that took me three hours to figure out what was wrong with the code. I'm sure some people are more familiar with it, but I'm not one of those people... probably because I avoid the language as much as I possibly can and try to make it behave like "any other language" even though it definitely isn't that.
Java:
JavaScript:
I do believe other people have pointed out what went on that caused this to happen. This thread was a joke, but I did learn a lot from it.