4
FlipFloop
209d

So at the HS I go to, there are 4~5 programmers (only 3 real "experienced" ones though including me).

So coming from JS & Python, I hate Java (especially for robotics) and prefer C++ (through some basic tutorials).

Programmer Nº2 is great at everything, loves Objective-C, Swift, Python, and to a certain extent Java.

Programmer Nº3 loves Python and used to do lots of C#, dislikes Java and appreciates Go (not much experience).

So naturally I get shit on (playfully) because of my JS background, because they don't understand many aspects of it. They hate the DOM manipulation (which is dislike too tbh), but especially OOP in JS, string/int manipulation, certain methods and HOISTING.

So, IDK if Java or C++ (super limited in them) have hoisting, but if you don't know what hoisting is, it means that you can define a variable, use it before assigning a value, and the code will still run. It also means that you can use a variable before defining it and assigning a value to it.

So in JS you can define a variable, assign no value to it, use it in a function for instance, and then assign a value after calling the function, like so:

var y;
function hi(x) {
console.log(y + " " + x);
y = "hi";
}
hi("bob");

output: undefined bob

And, as said before, you can use a variable before defining it - without causing any errors.
Since I can barely express myself, here is an example:
JS code:

function hi(x) {
console.log(y + " " + x);
var y = "hi";
}
hi("bob");

output: undefined bob

So my friends are like: WTF?? Doesn't that produce an Error of some sort?
- Well no kiddo, it might not make sense to you, and you can trash talk JS and its architecture all you want, but this somehow, sometimes IS useful.

No real point/punchline to this story, but it makes me laugh (internally), and since I really want to say it and my family is shit with computers, I posted it here.

I know many of you hate JS BTW, so I'm prepared to get trashed/downvoted back to the Earth's crust like a StackOverflow question.

Comments
  • 1
    Yeah, next time tell them to look up how "hoisting" works. There are somewhat similar examples in C++ and C as well.
  • 1
    You call yourself and other programmers experienced, but are focusing on which language each of you is fanboying? Lol ur not experienced at all.
  • 0
    @Npstr experienced - for HS. Not at all college level or pro or anything. Just that we’ve done stuff lmao
  • 3
    among all the features, hoisting? really?

    i mean... i understand all the functions in JS are implicitly anonymous, so in order to have function hoisting (which is more than ok) you had to give also the 'var' hoisting... but, c'mon!!! it's the end of 2018, we have let/const finally, "var" should simply get banned for good!

    my CI refuses to build/test/deploy and insults people on slack if it spots a 'var', or if just the linter has anything to say 😂
  • 1
    @thatsnotnice idk man, that bugs them
  • 0
    Ahah, here we go!! 😂👍
Your Job Suck?
Get a Better Job
Add Comment