Skip to content

Comments

(homework-5): addendum js#1

Open
BolatBerd wants to merge 1 commit intomainfrom
homework-5
Open

(homework-5): addendum js#1
BolatBerd wants to merge 1 commit intomainfrom
homework-5

Conversation

@BolatBerd
Copy link
Owner

@BolatBerd BolatBerd commented Oct 30, 2025

Comment on lines +5 to +8
const measureTemperature = (city, temperature) => {
console.log(`Сейчас в ${city} температура - ${temperature} градусов по Цельсию`);
}
measureTemperature("Тюмень", 10);

Choose a reason for hiding this comment

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

функция возвращает нам одно выражение, можно избавиться от фигурных скобок

Comment on lines +18 to +23
const measureSpeed = (speed) => {
if (speed > SPEED_OF_SOUND)
console.log("Сверхзвуковая скорость");
else
console.log("Дозвуковая скорость");
}

Choose a reason for hiding this comment

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

мжоно упростить условие до одного тернарного оператора, игнорируя фигурные скобки и if else блок

Comment on lines +37 to +45
const comparePrice = (budget) => {
const difference = price - budget;
if (budget > price)
console.log(`${product} приобретён. Спасибо за покупку!`);
else
console.log(`${product} Вам не хватает ${difference}, пополните баланс.`);
}

comparePrice(45);

Choose a reason for hiding this comment

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

мы не сравниваем цены. Мы покупаем продукт.. Можно также использовать тернарный оператор, но давай для разнообразия, оставим if else, но блок if else ВСЕГДА пишется с фигурными скобками, это является хорошим тоном

const product = "Хлеб";
const price = 50;

const comparePrice = (budget) => {

Choose a reason for hiding this comment

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

можно игнорировать фигурные скобки, так как здесь один параметр

Comment on lines +51 to +55
const calculateAmount = (priceProduct, quantity) => {
const amount = priceProduct * quantity
console.log(`Сумма = ${amount} руб.`);
}

Choose a reason for hiding this comment

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

результат добавление чисел - сумма
результат умножения числе - ...?

Намек понял, думаю

// 7. Создать 3 переменных (без разницы каких) и именовать их по своему усмотрению

const calculateAmount = (priceProduct, quantity) => {
const amount = priceProduct * quantity

Choose a reason for hiding this comment

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

точку с запятой пропустил

Comment on lines +1 to +11
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="homework-5.js"></script>
</body>
</html>

Choose a reason for hiding this comment

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

А где верстка вся?

@pocahontassss
Copy link

Это всё хитро, но я бы хотел увидеть все ДЗ

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