Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
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.
-
i
am going to beat you to death with a rusty hammer if you dont learn functional programming in the next 20 minutes -
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. -
@uyouthe
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. -
Guys it's all cool with functional programming but come on, a for each... even Pascal has it.
-
@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.
-
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.. -
@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.
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.
rant
foreach
wk229
static
javascript
instance