-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Polymorphism #84
base: Ivanov_Aleksej_Alekseevich
Are you sure you want to change the base?
Polymorphism #84
Conversation
const numerator = Math.log10(x * x - 1); | ||
const denominator = Math.log(a * x * x - b) / Math.log(5); | ||
result.push(numerator / denominator); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
дублирование кода
@@ -0,0 +1,20 @@ | |||
export function calcYA(a: number, b: number, x1: number, x2: number): number[] { | |||
const result: number[] = []; | |||
const xStep = 0.2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
почему это не параметр как остальные
@@ -0,0 +1,20 @@ | |||
export function calcYA(a: number, b: number, x1: number, x2: number): number[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
плохое название для параметров x1, x2
|
||
export function calcYB(a: number, b: number, xVal: number[]): number[] { | ||
const result: number[] = []; | ||
for (let i = 0; i < xVal.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for of
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
мы не в golang обычно index.ts или по смыслу называют
|
||
const result = calcYA(a, b, x1, x2); | ||
|
||
const expected = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
нам не важна такая точность можно проверить с округлением
@@ -0,0 +1,52 @@ | |||
import { calcYA, calcYB } from '../src/FunctionCalculate/calculate/calcFunction'; | |||
|
|||
describe('CalcYA', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно в обоих случаях добавить кейсы с изменением других параметров и проверки шагов
codewars/Array Deep Count/main.js
Outdated
let count = 0; | ||
for (let elem of a){ | ||
if(Array.isArray(elem)){ | ||
count += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
такое же действие на 8 строчке
} | ||
|
||
set setAge(newAge: number) { | ||
if (newAge >= 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
поменяйте условие на обратное и уберите внутрь if выброс ошибки, так уберете return и будет выглядеть чуть лучше
} | ||
|
||
set setColor(newColor: string) { | ||
if (newColor !== '') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тоже самое, проверьте везде это
No description provided.