10
rant1ng
6y

every fucking time I use Javascript.
(yes, I'm no expert, but I can pick up ANY LANGUAGE and do this task in FIVE FUCKING MINUTES, NOT AN HOUR!!! FUCK!)

"Gee, I think this button should probably list the total recipients of the mailing, looks like I have to get the total of a column in an object, no problem, hell, i'll do it frontside just for the fuck of it'

yeah, seemed like a good idea.. AN HOUR AGO

ARRRGGGH

fucking javascript scope can take a flying leap off of a tall building, and then NOT FALL to the fucking ground because it will fucking tell me that OOPS gravity doesn't exist for javascript!
UNCAUGHT REFERENCE ERROR
right?
FUCK YOU
die from gravity like you deserve motherfucker

Comments
  • 6
    I cannot see how it can take so much time?

    Yes JS has a few quirks but its mot that different once you have the basics.
  • 1
    @Voxera

    I'm using vue, with components and all that shit

    so, sometimes, the scope isn't so obvious

    and sometimes, its develishly unobvious

    so reading about basic scope in unealistically simple situations from a tutorial is definitively unhelpful and a complete waste of time, so you are forced to console.log everything and recompile, and run, and scratch your head, and repeat that for an hour, doesn't matter how much you learn about the previous experience, you could have doctorate on javascript scope, and it'll still trip you up with some obscure bullshit situation that will again, waste your fucking time
  • 4
    @rant1ng well vue is mostly not js any more and require a very different way of thinking.

    Same as react with redux or mobx.

    All centers on the state.

    Once you understand how the state works its easy again but no, you have very little use of plain js, or mostly any other language, knowlege.

    Even functional langs are very different.
  • 0
    @Voxera

    thanks for your soothing tone lol

    feel better now
  • 2
    I used Vue a lot, it's not really that bad, just throw a break point in where ever your not sure what the scope is, also Vue has browser plugins to debug Vue stuff.
  • 1
    @hexc yeah

    been working too hard

    didn't want to waste a good rant

    lol

    I love Vue actually
  • 1
    like...

    return Intl.NumberFormat().format(total);

    DOESN'T WORK

    but,

    total = Intl.NumberFormat().format(total);

    return total

    DOES WORK

    no error messages, no nothing, just doesn't work

    this is what i'm talking about
  • 1
    @rant1ng is total a local variable or global.

    In the later case, maybe its working because you change total.

    I checked a few examples and vue often seem to use functions that update a variable instead if returning a value ...

    But I don’t know enough to say its so, just throwing ideas around.
  • 1
    @Voxera

    it works now

    just the fact that I had to know that maybe javascript wants to assign the result of that expression, in this particular case

    it's the exact same thing, return (expression)

    or var = expression

    return var

    but one works, one doesn't

    go figure

    that's javascript
  • 1
    @rant1ng Never had that problem in js ever and I have used it since 1998 at least.

    So for js it should not matter, I think there is something else, either vue related or there is something with the total variable, maybe a watcher?
  • 1
    @Voxera probably vue related
  • 2
    @rant1ng probably.

    I know mobx had some similar quirks as it adds getters and setters to all watched variables and if you dereferences things the wrong way (pulling a value directly) it cannot keep track of what is happening.

    Maybe vue has something similar.

    Its very powerful but if you do not know about it it can create some very strange bugs.
  • 1
    @Voxera that's exactly what happens

    thanks for shedding light on the situation

    it just makes for some sometimes very frustrating and time consuming coding sessions
  • 3
    @rant1ng JavaScript will automatically add a semicolon at the end of a line with a return, even if you have something on the line after. So this:

    function foo() {
    return
    'foo';
    }

    is equal to:

    function foo() {
    return;
    }

    That's probably why putting the value in a variable works but returning it directly doesn't.
  • 2
    @shellbug

    ok. thanks for clearing that up, really appreciate it

    So, then....

    Why?

    Is there some sort of logic to doing this or...

    just I don't know.. curious.
  • 1
    @rant1ng automatic semicolon insertion. Look it up.

    This is why semicolons aren't required in JavaScript.
Add Comment