Codistwa

# Practice Conditional Expressions and logical operators - Quiz

beginner

## level 1

You've read the guide, now test your knowledge of Conditional Expressions and logical operators! If you have any doubt, you can go back to the guide.

### Question 1

What is the result?

javascript
1const eiffelTower = 300;
2const libertyTower = 36;
3
4if (eiffelTower > libertyTower) {
5  console.log('the Eiffel tower is higher');
6} else {
7  console.log('the Liberty tower is higher');
8}
Select...

### Question 2

What is the result?

javascript
1const sun = false;
2const moon = true;
3
4if(sun || moon) {
5  console.log('day or night');
6} else {
7  console.log('we don\'t know');
8}
Select...

### Question 3

How to transform this code into a ternary?

javascript
1const eiffelTower = 300;
2const libertyTower = 36;
3
4if (eiffelTower > libertyTower) {
5  console.log('the Eiffel tower is higher');
6} else {
7  console.log('the Liberty tower is higher');
8}
1
javascript
1const example = eiffelTower > libertyTower  || 'the Eiffel tower is higher';
2
javascript
1const example = eiffelTower > libertyTower ? 'the Eiffel tower is higher' : 'the Liberty tower is higher';
Select...

### Question 4

What is the response?

javascript
1const emotions = 'enjoyment';
2switch (emotions) {
3  case 'anger':
4    console.log('Try to calm down');
5    break;
7    console.log('Something is making you sad ...');
8    break;
9  case 'fear':
10    console.log('Something is scaring you');
11    break;
12  case 'enjoyment':
13    console.log('You are happy about something ...');
14    break;
15  case 'disgust':
16    console.log('You are disgusted by something!');
17    break;
18  default:
19    console.log(You have no emotion!);
20}
Select...