We can declare variables to store data by using the
let– is a modern variable declaration.
var– is an old-school variable declaration. Normally we don’t use it at all.
const– is like
let, but the value of the variable can’t be changed.
Please attempt these tasks on your own first, as this will cement your understanding. Only look at the solution if you are stuck or want to compare your solution.
console.log(must output “John”).
Examine the following code:
const birthday = '18.04.1982'; const age = someCode(birthday);
Here we have a constant
birthday date and the
age is calculated from
birthday with the help of some code (it is not provided for shortness, and because details don’t matter here).
Would it be right to use upper case for
age? Or even for both?