Dmitry plus lesson 13 homework#164
Dmitry plus lesson 13 homework#164dmitryplus wants to merge 13 commits intonickovchinnikov:masterfrom
Conversation
| return maxTeam; | ||
| } | ||
| }, | ||
| { name: "", score: 0 } |
There was a problem hiding this comment.
Можно не передавать начальное значение. Тогда reduce возьмет первый элемент
| ): string => { | ||
| const maxTeam: Team = teams.reduce( | ||
| (maxTeam: Team, item: Team) => { | ||
| if (item.score > maxTeam.score) { |
There was a problem hiding this comment.
Здесь лучше подойдет тернарный оператор
| qs = qs.replace("?", ""); | ||
|
|
||
| const parser = (str: string, delimeter: string) => | ||
| String(str).split(delimeter); |
There was a problem hiding this comment.
str итак строка. Зачем делать объектную обертку String(str)?
There was a problem hiding this comment.
проверял в консоли, там нет ts и нужно явно создавать экземпляр строки
тут убрал
| const result: ExpectedTeam = { | ||
| name: "New York Badgers", | ||
| roster: 25, | ||
| league: "", |
There was a problem hiding this comment.
Здесь лучше сразу присваивать originalTeam.league.
name тоже забираем из originalTeam
There was a problem hiding this comment.
присваивание league сделал. но name так нельзя - из Tampa Bay Roosters New York Badgers не получится
тест не проходит
| // eslint-disable-next-line | ||
| // @ts-ignore | ||
| ): Team => { | ||
| const result: Team = Object.assign({}, originalTeam, {}); |
There was a problem hiding this comment.
Здесь не происходит глубокое копирование. Только поверхностное
No description provided.