You can think of variables as a way to store information that might be needed on an application.
To define a variable, you can use
var myFavoriteNumber = 7 let myFavoriteFood = "Cereal" const myFriendsName = "John"
myFavoriteNumber contains the number 7.
myFavoriteFood contains the word "Cereal"
myFriendsName contains the word "John"
Lets say you're trying to remember what your friends name is. An easy way to keep this information in your application would be creating a variable and storing your friends name inside of it!
So our exact steps would be:
- Create a variable
- Assign it the value of your friends name
#Create The Variable and Assign it your Friends Name var myFriendsName = "Spongebob"