6

How can Javascript, one of the MOST WIDELY used and MATURE languages with A MILLION CANCEROUS FRAMEWORKS, NOT have a basic collections class? Are data structures not important in Javascript?

I've been struggling all night trying to get Sets working - surprise, they're utterly useless in Javascript cause you can't define the set comparator.

I just lost it when I found out THERE ISN'T EVEN A QUEUE. WT-ACTUAL-F

Comments
  • 0
    what do you want to achieve?
    What is your usual main driver? Java PHP?
  • 6
    You have array, it's a stack, queue, hash table.
  • 0
    You can create classes if you want to, but objects feel more classy then classes
  • 1
    Also, js is weak typed amigo.
  • 1
    @melezorus34 exactly! flow or even typescript can help a bit
  • 0
    @legacyJanitor depends on your choice. If I don't wanna have any new frameworks/game changers to learn I would go with JSDoc
  • 4
    I think I've had my own C# flavored version of your lament. Arrays, hashes, maps.. why doesn't everything have a common *enumerable* I can use? I hate having to

    Object.keys('foo').forEach(k => {
    foo[k] = 'r u fukkin kidding m8';
    });
  • 0
    @stisch afaik it should have a dynamic 'var'
  • 2
    I love how ES6 classes aren't classes.
    It's such a great language.

    For all the blind, this is dripping with sarcasm.
  • 1
  • 0
    "mature"
  • 1
    Keep it simple, stupid
  • 1
    @irene I can't believe this is the language Windows 8 bet their whole immersive shell on. It's just, so ugh
  • 2
    @Root I wrote a class heavy Javascript framework pre-2015. Defining classes as functions never really sat well with me.

    Fast forward to today, when I'm looking into Javascript again, and lo and behold they have classes! Or not. Turns out to be syntactic sugar and you have to work with all the weirdness of ugh ;_;
  • 1
    @Pogromist "You have array, it's a stack, queue, hash table."

    Are you *sure* it's a hash table? I don't want to be doing a "in/has" check and find out it's doing a O(n) iteration.

    From what I can tell, the workflow is: change between array and maps each time you need the functionality of either. That's 2n extra OVERHEAD per calculation, potentially adding a n per iteration, aka taking an overall O(n) function and making it O(n^2)!!

    That is so wtf-butt backwards to me.
Add Comment