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.
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;