fixed
This commit is contained in:
commit
121c264090
9 changed files with 31 additions and 31 deletions
|
@ -2,7 +2,7 @@ Just loop over the object and `return false` immediately if there's at least one
|
|||
|
||||
```js
|
||||
function isEmpty(obj) {
|
||||
for(let key in obj) {
|
||||
for (let key in obj) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -4,10 +4,10 @@ let salaries = {
|
|||
John: 100,
|
||||
Ann: 160,
|
||||
Pete: 130
|
||||
}
|
||||
};
|
||||
|
||||
let sum = 0;
|
||||
for(let key in salaries) {
|
||||
for (let key in salaries) {
|
||||
sum += salaries[key];
|
||||
}
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ For instance:
|
|||
```smart header="Historical notes"
|
||||
For historical reasons, methods `toString` or `valueOf` *should* return a primitive: if any of them returns an object, then there's no error, but that object is ignored (like if the method didn't exist).
|
||||
|
||||
In contrast, `Symbol.toPrimitive` *must* return an primitive, otherwise there will be an error.
|
||||
In contrast, `Symbol.toPrimitive` *must* return a primitive, otherwise, there will be an error.
|
||||
```
|
||||
|
||||
## Summary
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue