Skip to content

Commit 4349ed1

Browse files
authored
Modify contains function to handle arrays
Add check for arrays in contains function
1 parent aa5ee68 commit 4349ed1

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎Sprint-2/implement/contains.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
function contains(obj, prop) {
2-
return obj.hasOwnProperty(prop); // checks if the property exists in the object and returns true or false
2+
if (Array.isArray(obj)) {
3+
return false; // returns false if an object contains an array
4+
}
5+
return obj.hasOwnProperty(prop);
36
}
4-
5-
module.exports = contains;

0 commit comments

Comments
 (0)