diff --git a/snippets/cleanObj.md b/snippets/cleanObj.md index f2a915719..82cfe4441 100644 --- a/snippets/cleanObj.md +++ b/snippets/cleanObj.md @@ -13,11 +13,11 @@ const cleanObj = (obj, keysToKeep = [], childIndicator) => { } else if (!keysToKeep.includes(key)) { delete obj[key]; } - }) +  }); + return obj; } /* const testObj = {a: 1, b: 2, children: {a: 1, b: 2}} - cleanObj(testObj, ["a"],"children") - console.log(testObj)// { a: 1, children : { a: 1}} + cleanObj(testObj, ["a"],"children") // { a: 1, children : { a: 1}} */ ```