Codistwa

Practice Variables and types - Quiz

beginner

level 1

You've read the guide, now test your knowledge of Variables and types! If you have any doubt, you can go back to the guide.
Liveprojectsmanning

Question 1

Which variable has the type string?

javascriptjavascript
1const color = 'red';
2const age = 29;
Select...

Question 2

How to get this sentence? «I have spent $30 today.»

javascriptjavascript
1const beginning = 'I have spent';
2const money = 30;
3const end = 'today.';
1
javascriptjavascript
1console.log(beginning + money + end);
2
javascriptjavascript
1console.log(beginning + ' $' + money + ' ' + end);
Select...

Question 3

How to display «105»?

javascriptjavascript
1console.log('10' + 5); 
2console.log('ten' + 5);
Select...

Question 4

What is the scope of the doors variable?

javascriptjavascript
1const doors = 5;
2
3function getDoors() {
4  console.log(doors);
5}
6
7console.log(getDoors());
Select...

Question 5

What is the value of the variable flower?

javascriptjavascript
1let flower = 'red';
2const roses = 2;
3
4flower = roses;
5
6console.log(flower);
Select...

Question 6

What is the type of the variable «bulb»?

javascriptjavascript
1const bulb = 'yellow';
2
3console.log(typeof(bulb));
Select...

Question 7

How to improve the name of this variable?

javascriptjavascript
1const open = true;
1
javascriptjavascript
1const isOpen = true;
2
javascriptjavascript
1setOpen = true;
Select...