Variables Flashcards

1
Q

Whats the difference between declaring a variable with the keyword let and const?

A

When a variable is assigned with const, the value is constant and will not change, so it can’t be reassigned, with the keyword let it can.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Create a variable called number and assigned it a random number from 0 to 30 and then reassign the value, so that it’s rounded to the nearest 10.

A
var number = Math.floor(Math.random() * 30);
number = Math.round(number / 10) * 10;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly