Variables & Values

🧢 Tags:: #JavaScript
πŸ—ƒ Resources:: [[]]
πŸ”— Links::
2022-11-19 - 22:39

Variables are like containers. You can save a value inside a variable.
Pasted image 20221119224932.png


let todo1 = 'get groceries';

let todo2 = 'wash car';

let todo3 = 'make dinner';


So when we go to the console and type 'console.log(todo1);' it gives us the output 'get groceries.'
But if we do the same thing by adding quotes to todo1, 'console.log('todo1');' it gives us the out of 'todo1'.

todo1 is a variable, a container which will log the value inside the variable. But todo1 with quotes around it is not a variable anymore, it's an actual value.

todo1 is a string which we can see by typing in the console 'typeof' which will give us the output of 'string'

Exercise 3 -


let month = 'November';

let day = '20';

let year = '2022';



let age = '28';

let message = 'Iam' + age + 'years old';