BananaMaster

14 - The === operator and if else in JavaScript | JS lessons

If you forgot something — click to go to the lesson.

Task 1.

Create an input with type="number", a button, and a div. When the button is clicked, check the value: if the number is greater than 10 — display "big", otherwise "small".

Input i-1

Task 2.

Create a checkbox input, a button, and a div. When the button is clicked, check the checkbox state: if it is checked — display "true", otherwise "false".

Task 3.

Create a checkbox input and a button. When the button is clicked, if the checkbox is checked — change the button’s background color to green, otherwise — to red. ('red', 'green')

Task 4.

Create a checkbox input, a button, and a div. If the checkbox is checked — display the text "Visible", otherwise show nothing.

Task 5.

Create an input with type="number", a button, and a div. When the button is clicked, check the value: if the number equals 0 — display "zero", otherwise "not zero".

Task 6.

Create two inputs with type="number", a button, and a div. When the button is clicked, display the smaller number.

Task 7.

Create a checkbox input and a button. When the button is clicked, log "call" to the console if the checkbox is checked, otherwise do nothing.