1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Build lodash.pick from Scratch

    javascriptJavaScript

    _.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.

    1. Using for...of to loop through the keys array
    2. Using for..in to loop through the target object

    This 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().