JS' array function forEach. Why. Why does it exist? How is a function with a callback better than a freaking simple language feature like for of? If I recall correctly, forEach is older than for of, but people still use it nowadays, and too frequently...
Hate it, definitely.
Also, talking about enumeration in JS, Object's "static" method entries. I can't see how it can't be an instance method. Same for keys and values, but I usually don't care about them.

  • 12
    I like one-liner codes and ForEach helps in that
  • 6
    JS arrays are the ultimate example of how JS puts ease of use over sanity. Arrays carry the weight of a stack, queue and a dictionary.
  • 6

    am going to beat you to death with a rusty hammer if you dont learn functional programming in the next 20 minutes
  • 2
    Translation: I suck at functional programming.

    The syntax you're complaining about is the best way. JS in 2020 isn't meant to be written procedurally.
  • 5
    @hashedram callbacks are not functional programming lol
  • 1

    Callbacks are more functional than for loops. They're technically procedural and I don't know for the life of me why Node picked that syntax over promises but it's a ton better than what OP wants to do.

    fs.readFile(file, function(){..doshit..}....).bind()

    Stuff like this is called currying (FP as fk) and you can't do it in JS without knowing how callbacks work.
  • 0
    Guys it's all cool with functional programming but come on, a for each... even Pascal has it.
  • 1
    @hashedram lol boubas be like nooo sir you wrong excuse me sir you wrooong lmao
  • 0
    @uyouthe You can lmao after writing any FP feature in JS without using a callback function. You're not paying attention to the point. The concept of callback functions itself is procedural. Its just that almost all functional features in the language are built using callbacks. Your disagreement is irrelevant, that's just how the language built. That's why everyone in the other comments are associating this style of syntax with FP.
  • 1
    There you are all arguing about thing x & discussing A, mentioning premises & shit.. o.O // I think my js style is stuck at the beginning of my projects life..like ~10+ years passed already when I joined this company..

    And here I am having to actually lookup procedural and functional programing definitions.. o.O // I reeeeaallly need to readup and 'updo' my terminology..
    Those are logged in my head under 'script like' and 'oop without all the unnecessary marriage to object(s)'... No wonder coworkers think I'm nuts when I try to explain things without knowing proper names to call them..
  • 1
    @theabbie I like one liners too, but in js it's just too much to be ok
    Y'all have minifiers, why do you still write this ugly code...
  • 0
    @alert Not all code is supposed to be Readable, and, the goal of one-liner is not to make code shorter. You feel like some achievement when you do the same task in one line.
Add Comment