Skip to content
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

Open
wants to merge 6 commits into
base: Ivanov_Aleksej_Alekseevich
Choose a base branch
from

Conversation

Krovaldo
Copy link

@Krovaldo Krovaldo commented Nov 6, 2024

No description provided.

Comment on lines 5 to 7
const numerator = Math.log10(x * x - 1);
const denominator = Math.log(a * x * x - b) / Math.log(5);
result.push(numerator / denominator);

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;

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[] {

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++) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for of

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 = [

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', () => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно в обоих случаях добавить кейсы с изменением других параметров и проверки шагов

let count = 0;
for (let elem of a){
if(Array.isArray(elem)){
count += 1

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) {

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 !== '') {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тоже самое, проверьте везде это

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants