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 0cdfa17 commit 59c72d3Copy full SHA for 59c72d3
1 file changed
Sprint-2/implement/contains.js
@@ -1,21 +1,9 @@
1
function contains(obj, prop) {
2
- if (obj === null) {
+ if (obj === null || typeof obj !== "object" || Array.isArray(obj)) {
3
return false;
4
}
5
6
- if (typeof obj !== "object") {
7
- return false;
8
- }
9
-
10
- if (Array.isArray(obj)) {
11
12
13
14
- if (prop in obj) {
15
- return true;
16
- } else {
17
18
+ return Object.hasOwn(obj, prop);
19
20
21
module.exports = contains;
0 commit comments