Skip to content

Commit 3651346

Browse files
authored
Implement contains function to check object properties
1 parent a7a69c5 commit 3651346

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎Sprint-2/implement/contains.js‎

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

39
module.exports = contains;

0 commit comments

Comments
 (0)