We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 897b2c1 commit 59c6768Copy full SHA for 59c6768
14_contains/solution/contains-solution.js
@@ -1,5 +1,11 @@
1
-const contains = function() {
2
- // Replace this comment with the solution code
+const contains = function(current, search) {
+ if (Object.values(current).includes(search)) return true;
3
+
4
+ for (const nestedObject of Object.values(current).filter((value) => typeof value === 'object')) {
5
+ return contains(nestedObject, search)
6
+ }
7
8
+ return false
9
};
10
11
// Do not edit below this line
0 commit comments