BananaMaster

13 - if else conditions in JavaScript | JS lessons

Если что то забыли кликни для перехода на урок

Task 1.

When the button is clicked, read the value from the input and compare it with 4. If the number is greater — log "Good", if less — log "No" (to the console).

Input i-1

Task 2.

Create two variables: a21 = 20 and a22 = 40. When the button is clicked, compare them using if/else and log the larger number to the console.

Task 3.

Create two inputs with type="number". When the button is clicked, display the larger number inside the div.

Task 4.

Create an input (type="number"), a button, and a div. The user enters their birth year. When the button is clicked, display 1 in the div if the user is older than 18, otherwise display 0.

Task 5.

Create a select with options "yes" and "no", and a button. When the button is clicked, get the selected value and check it using if/else. If "yes" — log "agreed", if "no" — log "disagreed".

Use strict comparison: (value === "yes").

Task 6.

Create two inputs with type="number", a button, and a div. When the button is clicked, calculate their sum. If the sum is greater than 50 — display "true", otherwise "false".

Task 7.

Create an input with type="number", a button, and a div. When the button is clicked, check the number: if it is greater than 0 — display "+", otherwise display "-".