BananaMaster

17 - Logical operators && || (JS lessons)

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

Task 1.

Create two input type="number", a button, and a div. If both numbers are greater than 0 — display "good", otherwise — "no".

Task 2.

Create two input type="number", a button, and a div. If at least one number is greater than 100 — display "big", otherwise — "small".

Task 3.

Create an input type="number", a button, and a div. If the number is greater than 10 and less than 100 — display "in", otherwise — "out".

Task 4.

Create two input type="text", a button, and a div. If both fields are not empty — display "good", otherwise — "bad".

Task 5.

Create an input type="text", a button, and a div. If the input value is "cat" or "dog" — display "pet", otherwise — "not a pet".

Task 6.

Create an input type="number" and a div. On any change — if the number is less than 0 or greater than 255 — display "invalid", otherwise — "valid".

Task 7.

Create an input type="number", a button, and a div. Enter an apartment number and determine which entrance it belongs to. Each entrance has 20 apartments: 1–20 — entrance 1, 21–40 — entrance 2, 41–60 — entrance 3, 61–80 — entrance 4, 81–100 — entrance 5. If the number is outside the range — display "invalid".