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

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


_.pick(object, [paths])


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