_.pick
and its sibling _.omit
are popular utilities which apply filter-like functionality to objects. This lesson will demonstrate two different techniques for building the functionality found in _.pick.
for...of
to loop through the keys
arrayfor..in
to loop through the target objectThis lesson will also cover how to emulate _.pick
's support for either an array or multiple arguments for the picked keys using Rest params and Array.prototype.flat().