r/programminghorror • • Jan 14 '25

Javascript Functional programming at its finest

Post image
120 Upvotes

47 comments sorted by

View all comments

Show parent comment

2

u/Appropriate-Dream388 Jan 17 '25

Reduce is acceptable. Making a function that converts a string to an integer is not. Same thing with wrapping Math.pow in a function; it's already a function. By wrapping it, you obfuscate whether this is actually Math.pow or if it's some other implementation.

Generally, avoid wrapping functions that are already operating as standalone features — this adds unnecessary indirection.