Update snippet descriptions

This commit is contained in:
Isabelle Viktoria Maciohsek
2020-10-19 18:51:03 +03:00
parent f0fbe0c3e5
commit 5e8e6f51a3
36 changed files with 97 additions and 82 deletions

View File

@@ -3,11 +3,11 @@ title: deepGet
tags: object,intermediate
---
Returns the target value in a nested JSON object, based on the `keys` array.
Gets the target value in a nested JSON object, based on the `keys` array.
- Compare the keys you want in the nested JSON object as an `Array`.
- Use `Array.prototype.reduce()` to get value from nested JSON object one by one.
- If the key exists in object, return target value, otherwise, return `null`.
- Use `Array.prototype.reduce()` to get the values in the nested JSON object one by one.
- If the key exists in the object, return the target value, otherwise return `null`.
```js
const deepGet = (obj, keys) =>