Skip to content

Commit 52eaa63

Browse files
authored
typo
1 parent 6f14c39 commit 52eaa63

File tree

1 file changed

+3
-3
lines changed
  • 1-js/04-object-basics/09-object-toprimitive

1 file changed

+3
-3
lines changed

1-js/04-object-basics/09-object-toprimitive/article.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ In case of such operations, objects are auto-converted to primitives, and then t
99

1010
That's an important limitation, as the result of `obj1 + obj2` can't be another object!
1111

12-
E.g. we can't make objects representing vectors or matrices (or archievements or whatever), add them and expect a "summed" object as the result. Such architectural feats are automatically "off the board".
12+
E.g. we can't make objects representing vectors or matrices (or achievements or whatever), add them and expect a "summed" object as the result. Such architectural feats are automatically "off the board".
1313

1414
So, because we can't do much here, there's no maths with objects in real projects. When it happens, it's usually because of a coding mistake.
1515

@@ -133,7 +133,7 @@ As we can see from the code, `user` becomes a self-descriptive string or a money
133133

134134
If there's no `Symbol.toPrimitive` then JavaScript tries to find methods `toString` and `valueOf`:
135135

136-
- For the "string" hint: `toString`, and if it doesn't exist, then `valueOf` (so `toString` has the priority for stirng conversions).
136+
- For the "string" hint: `toString`, and if it doesn't exist, then `valueOf` (so `toString` has the priority for string conversions).
137137
- For other hints: `valueOf`, and if it doesn't exist, then `toString` (so `valueOf` has the priority for maths).
138138

139139
Methods `toString` and `valueOf` come from ancient times. They are not symbols (symbols did not exist that long ago), but rather "regular" string-named methods. They provide an alternative "old-style" way to implement the conversion.
@@ -274,4 +274,4 @@ The conversion algorithm is:
274274

275275
In practice, it's often enough to implement only `obj.toString()` as a "catch-all" method for string conversions that should return a "human-readable" representation of an object, for logging or debugging purposes.
276276

277-
As for math operations, JavaScript doesn't provide a way to "override" them using methods, so real life projects rarely use them on objects.
277+
As for math operations, JavaScript doesn't provide a way to "override" them using methods, so real life projects rarely use them on objects.

0 commit comments

Comments
 (0)