Skip to content

Commit c818489

Browse files
committed
Object.hasOwn
1 parent feb2a33 commit c818489

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

js/red-javascript-style-guide/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = {
99
// overwrite
1010
"no-unused-vars": 1,
1111

12+
"prefer-object-has-own": 2,
1213
"curly": 2,
1314
"eqeqeq": 2,
1415
"no-caller": 2,

js/red-javascript-style-guide/readme.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,11 @@ const object = [
152152
];
153153
```
154154

155-
Use `Object.keys`, `Object.values`, `Object.entries` to convert it to an array, then use array methods to loop over an object. ```typeof x === `object` && x !== null``` for type checking.
155+
Use `Object.keys`, `Object.values`, `Object.entries` to convert it to an array, then use array methods to loop over an object.
156+
157+
```typeof x === `object` && x !== null``` for type checking.
158+
159+
`Object.hasOwn` to check the existence of a property-value pair.
156160

157161
### strings
158162

0 commit comments

Comments
 (0)