JAVASCRIPT · ОСНОВЫ · LESSON 09

Two questions at once.

&& и || · about 12 minutes

Learning with progressRead the summary for free. To save the work, log in to the account.
STEP 1

And we need both answers.

&& означает «и». Всё условие верно, когда обе проверки верны.

const age = 9;
console.log(age >= 7 && age <= 12);

✦ Nine enters the gap.

STEP 2

Or one is enough.

| stands for «или». One correct check is enough.

const day = 6;
console.log(day === 6 || day === 7);

✦ Day six fits.

IN-CLASS PRACTICE

Type the code yourself

Type an example manually. Check the names, brackets and signs.

const age = 9;
const allowed = age >= 7 && age <= 12;
console.log(allowed);
Open the editor for class work
HOMEWORK

Solve it yourself

Create const points = 8. Save in const passed check that points is not less than 5 and not more than 10. Take out passed.

The answer is hidden. Use similar examples from the lesson notes.

Opening up your homework