Conversation
projects/array-objects/index.js
Outdated
| for (let i = 0; i < array.length; i++) { | ||
| fn(array[i], i, array); | ||
| } | ||
| //function fn(item, i, array) { |
projects/array-objects/index.js
Outdated
| a = fn(array[i], i, array); | ||
| newArr.push(a); | ||
| } | ||
| //function fn(item) { |
There was a problem hiding this comment.
Так не делают. Если надо оставить коменты то сначала полезный код(return в данном случае) потом комментарии, а так золотое правило на ревью коменты не отправляем
projects/array-objects/index.js
Outdated
| for (; i < array.length; i++) { | ||
| s = fn(s, array[i], i, array); | ||
| } | ||
| //function fn(sum, item) { |
| let tr = 0; | ||
| let fal = 0; | ||
| //try { | ||
| if (!Array.isArray(array) || array.length === 0) { |
There was a problem hiding this comment.
Запрещено использовать встроенные методы для работы с массивами
projects/exceptions/index.js
Outdated
| } | ||
|
|
||
| if (tr === array.length) { | ||
| console.log(true); |
There was a problem hiding this comment.
Здесь и далее console.log здесь смысл такой как с комментариями в финальном коде их быть не должно
| let tr = 0; | ||
| let fal = 0; | ||
| //try { | ||
| if (!Array.isArray(array) || array.length === 0) { |
There was a problem hiding this comment.
Запрещено использовать встроенные методы для работы с массивами
projects/exceptions/index.js
Outdated
| @@ -0,0 +1,236 @@ | |||
| /* ДЗ 3 - работа с исключениями и отладчиком */ | |||
|
|
|||
| //import { error } from 'console'; | |||
projects/exceptions/index.js
Outdated
|
|
||
| for (let i = 0; i < array.length; i++) { | ||
| const z = fn(array[i], i, array); | ||
| if (z === true) { |
There was a problem hiding this comment.
z ? tr++ : fal++; так оно как то получше будет.
Тут булевое значение, если уже и мы его проверяем то if-else будет достатоно
projects/exceptions/index.js
Outdated
|
|
||
| for (let i = 0; i < array.length; i++) { | ||
| const z = fn(array[i], i, array); | ||
| if (z === true) { |
There was a problem hiding this comment.
z ? tr++ : fal++; так оно как то получше будет.
Тут булевое значение, если уже и мы его проверяем то if-else будет достатоно
projects/exceptions/index.js
Outdated
| }, | ||
| }; | ||
| } | ||
| /*const myCalc = calculator(); |
Выполненное ДЗ неделя 2