Skip to content

Commit 59c6768

Browse files
committed
feat/ create solution
1 parent 897b2c1 commit 59c6768

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

14_contains/solution/contains-solution.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
const contains = function() {
2-
// Replace this comment with the solution code
1+
const contains = function(current, search) {
2+
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
39
};
410

511
// Do not edit below this line

0 commit comments

Comments
 (0)