Project 1:
Kelvin Weather
Deep in his mountain-side meteorology lab, the mad scientist Kelvin has mastered weather prediction.
Recently, Kelvin began publishing his weather forecasts on his website. However there’s a problem: All of his forecasts describe the temperature in Kelvin.
With our knowledge of JavaScript, let’s convert Kelvin to Celsius, then to Fahrenheit.

Project 2:
Magic Eight Ball:
Kelvin Weather
Deep in his mountain-side meteorology lab, the mad scientist Kelvin has mastered weather prediction.
Recently, Kelvin began publishing his weather forecasts on his website. However there’s a problem: All of his forecasts describe the temperature in Kelvin.
With our knowledge of JavaScript, let’s convert Kelvin to Celsius, then to Fahrenheit.

Project 2:
Magic Eight Ball:
JavaScript:
let userName = '';
userName ? console.log(`Hello, ${userName}'!'`) : console.log('Hello!');
let userQuestion = 'Пользователь спрашивает: ';
userQuestion ? console.log(`${userName}`) : console.log(`${userQuestion}`);
const randomNumber = Math.floor(Math.random() * 8);
let eightBall = '';
switch (randomNumber) {
case 0:
eightBall = 'Да, это именно так.';
break;
case 1:
eightBall = 'Это однозначно так.';
break;
case 2:
eightBall = 'Я теряюсь с ответом, может, перефразируете?';
break;
case 3:
eightBall = 'Я этого не знаю, друг=)';
break;
case 4:
eightBall = 'Даже и не думай об этом, засранец!';
break;
case 5:
eightBall = 'Мой внутренний голос подсказывает, что это не так.';
break;
case 6:
eightBall = 'Это плохая идея.';
break;
case 7:
eightBall = 'Если ты доверяешь этим камням, то камни говорят - да';
break;
}
console.log(`Шар отвечает тебе: ${eightBall}`);
Последнее редактирование: