1//Making variables with let:
2let numberOfFriends = 1;
3
4//Incrementing:
5numberOfFriends += 3; //numberOfFriends is now 4
6
7// Variables with const
8const minimumAge = 21; //CANNOT REASSIGN!
9
10//Booleans - true or false values
11true;
12false;
13let isHappy = true;
14
15//Naming Conventions
16// Use upper camel-cased names:
17let numberOfChickens = 6; //GOOD
18// NOT THE JS WAY:
19// let number_of_chickens = 6;
1 Variables can have anything, you define them as equal to something
2
3 eg: var x = 22
4 var statement = 'hello!'
5 var isAbool = true
6
7 there are three types of variables:
81. var
92. let
103. const
11
12var is a normal variable
13let is a variable whose value can be changed eg: let h = 12, h = 10(we changed the value, if you run this, there will be no error)
14const is a variable whose value cannot be changed, if you change the value of a const, you will have errors in you code
1//variables are a way to easily store data in javascript
2//variables are declared by the var keyword, example...
3var x = 10;
4//or
5var dog_name = "daisy";
6//which can also be written as
7var dog_name = 'daisy';
8//same thing with single quotes and double quotes
1// 3 ways to create
2
3var mrVariable = 'x'; // You can set it to to a string ( '' ) or no. ( 0 ). It
4// is globally defined
5
6let myVariaible2 = 'y'; // You can set it to string or no. let is block scoped
7
8const myVariable = 'z'; // It is block scoped, can be a string or no. and can't
9//be reassigned