Created
May 6, 2025 13:43
-
-
Save malbontee/733157bcca926b8d5ddd601a8c162dbb to your computer and use it in GitHub Desktop.
hw1_JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<link rel="icon" type="image/svg+xml" href="/webstorm-icon-logo.svg" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>WS playground</title> | |
<link rel="stylesheet" href="/style.css"> | |
</head> | |
<body> | |
<header class="logo"> | |
<a href="https://www.jetbrains.com/webstorm/"> | |
<img src="/webstorm-logo.svg" alt="WebStorm logo" width="344" | |
height="90"> | |
</a> | |
</header> | |
<main id="app"> | |
<h1 class="title"> | |
Thank you for trying it out. <br /> Your first project is up and running | |
now. | |
</h1> | |
<section class="counter"> | |
<div class="counter-info"> | |
<p class="counter-text">Counter is</p> | |
<p class="counter-value" id="counter-value"></p> | |
</div> | |
<div class="counter-interaction"> | |
<button id="increaseByOne" type="button">+1</button> | |
<button id="increaseByTwo" type="button">+2</button> | |
<button id="decreaseByOne" type="button">-1</button> | |
<button id="decreaseByTwo" type="button">-2</button> | |
</div> | |
</section> | |
</main> | |
<footer class="technologies"> | |
<img src="/technologies.svg" alt="List of supported technologies"> | |
</footer> | |
<script> // Запросіть у користувача число, зведіть це число в 2 ступінь та виведіть на екран. | |
let input = prompt('Enter a number'); | |
alert(input ** 2); | |
// Запросіть у користувача 2 числа та виведіть середнє арифметичне цих чисел. | |
let input1 = prompt('Enter a number'); | |
let input2 = prompt('Enter a number'); | |
alert((Number(input1) + Number(input2)) / 2); | |
// Запросіть у користувача його ім'я та виведіть у відповідь «Привіт, (його ім'я)!». | |
let name = prompt('Enter your name'); | |
alert('Hello, ' + name + '!'); | |
// Запросіть у користувача його рік народження, підрахуйте скільки йому років і виведіть результат. Поточний рік вкажіть у коді як константу. | |
const currentYear = 2025; | |
let birthYear = prompt('Enter your birth year'); | |
alert(currentYear - birthYear); | |
// Запросіть у користувача довжину сторони квадрата та виведіть його периметр. | |
let side = prompt('Enter a side of a square'); | |
alert('Perimeter is: ' + Number(side) * 4); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment