Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Fair enough. In js slicing with a negative index would grab from the end of the array, but if the end index is positive it'll return an empty string so it's safe in this case

I think the tradeoff is how much of the API you need to memorize. In JS if you know .filter, .map, and .reduce you're good for 95% of use-cases (technically .reduce can be used to implement every other method, but it can get messy). I also work with Ruby at my job and I constantly find myself wondering if this is the best tool for the situation

This was my first job using Ruby so it's definitely become less of a problem over time and I think if it's your MAIN language then having a fat API like that is fine. But I do think there's a trade-off and it can introduce more spaces for bad practices





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: