Implement lodash.pick from scratch | Problem Solving | Frontend Interview Question
@Yomesh Gupta

JavaScriptIntermediate
413
Do you see value in our efforts?

Devtools Tech is a free platform for Frontend Engineers. It takes a lot of time, effort, and finanical resources to keep the platform running. If you see any value in our work and would like to support us then you can do using the following options.

InternationalDomestic

In this question, the candidate must replicate the functionality of _.pick from lodash.

Syntax:

_.pick(object, [paths])

Arguments:

object (Object): The source object.
[paths] (...(string|string[])): The property paths to pick.

pick method creates an object composed of the picked object properties.

var object = { 'a': 1, 'b': '2', 'c': 3 };
 
_.pick(object, ['a', 'c']);
// => { 'a': 1, 'c': 3 }

Loading IDE...