Using _.pick() function from lodash

Easy
33.3% Acceptance

In this lab, you'll be working with the _pick() function in lodash. Lodash is a popular JavaScript utility library that provides helpful functions for common programming tasks. The _.pick() function creates an object by picking properties from another object based on the keys provided.

You will be creating a function called filteredObject that takes two arguments: an object inputObj and an array of strings keyArrayList. The goal is to use lodash's _.pick() inside filteredObject to create and return a new object with only the properties specified in keyArrayList from inputObj.

Challenges

  1. Import the lodash package and assign it to a variable named _.
  2. Create and export a function called filteredObject that accepts two arguments: inputObj and keyArrayList.
  3. The filteredObject function should use lodash's _.pick() function to pick the properties from inputObj specified in keyArrayList and return the new object.
  4. Make sure the filteredObject function works with various input examples.

Note: You will need to install the lodash package (npm install lodash) and import it in your solution. Don't forget to include lodash as a dependency in your package.json file in the solution.