r/javascript • • Mar 02 '19

Useful javascript one-liners.

https://medium.com/@smellycode/js-one-liners-8bc0a6af2345?source=friends_link&sk=a9295a05aef9e514e137fca7eeb89cd1
344 Upvotes

96 comments sorted by

View all comments

-5

u/BinxyPrime Mar 02 '19

You can do almost all of these in one line with lodash and its probably optimized better

2

u/greymalik Mar 02 '19

But when I’m interviewing for a job and they ask me to dedupe an array on the whiteboard they’re not going to like _.uniq as an answer. It can be good to know the bare metal way to do things.

2

u/BinxyPrime Mar 02 '19

They probably wouldnt really love the n squared brute force one liner either though