Using _.defaultTo() in lodash
Medium
50.0% Acceptance
In this lab, you will learn to use _.defaultTo()
function from lodash library. This function checks a value and returns the default value if the value is either null
, undefined
, or NaN
. The _.defaultTo()
function can be very useful when assigning default values to function parameters or object properties.
To begin, you need to install lodash and import it into your index.js
file using ESM. Then, complete the following challenges.
Note: Do not forget to export whatever you are asked to inside the challenges block.