Skip to content

Commit 44fd831

Browse files
authored
Implement contains function to check object properties
1 parent 2f702f0 commit 44fd831

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎Sprint-2/implement/contains.js‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
function contains() {}
1+
function contains(obj, property) {
2+
if (obj === null || typeof obj !== "object" || Array.isArray(obj)) {
3+
return false;
4+
}
5+
return property in obj;
6+
}
27

38
module.exports = contains;

0 commit comments

Comments
 (0)