Hey buddies, how are you doing?
I'm Filipi and we are now beginning our second class
Actually it's the second part of our first class
This one will be a quick one I just need to show you guys just a little more
Do you remember that we only had a POCKET and a TEXT?
Well, now we are going to play with our POCKET
In this video I'll show you, buddies, how to do operations
and what we can do to show that our pocket has something
On the last video we created a variable POCKET and another variable TEXT
TEXT used to contain "This is our first text"
But as we are going to modify POCKET and work with the concept of money
I change the content of TEXT to "This is my total amount of money"
We can begin typing our code saying that our POCKET is going to receive a certain amount of money
In this case we are going to work with... hm... an allowance
Each month, our POCKET will receive 20 dollars
Pay attention that I put "20" inside POCKET
Now our POCKET has "20".
This is a number
and we are going to refer to it as "20 dollars"
But we went to the store and we wanted to buy a chocolate bar
and today, the chocolate bar costs 5 dollars
So we are going to subtract from our POCKET "5"
and the result will return to our POCKET
Now we are going to add more money to our POCKET
We found some coins laying around So we found 10 dollars
So our POCKET will receive 10 dollars
To do that, we are going to add in our POCKET "10"
Let's go back to the beginning of the line and type "POCKET ="
Now let's check how much money we have inside our POCKET
As I showed you guys last class, we can print in javascript
So we are going to type "console.log"
And we are going to add a text
"This is our total amount of money:"
and we are going to add another parameter
The method CONSOLE.LOG can receive lots of parameters
We can add texts, or variables. In this case, we are going to add a text AND a variable
So we are going to add "This is our total amount of money:" And our variable POCKET
So we can see better, I'm gonna zoom in a little bit
I'm clicking on the Debug Zone button
and hit the PLAY button
let's see what's going to happen
As we can see, our code run
We can see our first 2 "CONSOLE.LOG"
One printing "This is our first log" And the second printing "This is my total amount of money"
And at the end of our code, we added another CONSOLE.LOG, with a text and our variable
We can see that the text was printed, along side our amount of money
Let's verify it
We had 20
We lost 5 bucks because we bought the chocolate bar
Resulting in 15 bucks
And then we added 10 dollars
Resulting in 25 dollars
As we see on our debug console, everything is alright
And we can print the result every step on the way
Just copy and paste it
Let's comment our first 2 console.log
Because they don't provide any relevant information about our POCKET
Let's run it again and see what happens
That's it. First we had 20
We bought the chocolate bar, 15
Then we added 10, 25
And this is how we add operations in our javascript code
You need a VARIABLE That will receive an operation
And it don't need to be a simple one. It can be a complex operation
Like this, lets add to our POCKET 100 bucks, then subtract 5,
multiply by 30, and divide all by 10
Here we have all 4 arithmetic operations
How much will our POCKET contain?
Let's run our code and check it out
Look... 110 bucks
A LOT =)
That's it buddies
Now we know how to perform operations
This is a very important step
In summary, first we need to create variables
In this code, POCKET and TEXT
Later we saw how to print in js. Using CONSOLE.LOG
And last but not least, we did lots of operations
Like adding, subtracting, multiplying and dividing
And that's all for today
We are going to learn more complex things beginning next week
If you liked this video, SMASH that thumbs up button
and subscribe to my channel
And leave it a comment down below
We you have anything to say
Buddies, I'm gonna be here every week with new videos
I'm preparing a place where we can talk, share stories, codes and answer questions you may have
Next video I'm gonna reveal the link to this place
I'll see you all soon buddies, Bye bye
For more infomation >> HHS OIG Robo de Identidad Médico-Anuncio de Servicio Publico (80 segundos) - Duration: 1:21. 
For more infomation >> U&D: Barbara De Santi e la polemica sulla sua foto 'bollente' - Duration: 3:54.
For more infomation >> Nina Dobrev dévoile sa nouvelle coupe de cheveux, ses fans adorent ! - Duration: 3:01.
For more infomation >> Mort de Hugh Hefner, le fondateur de Playboy, à l'âge de 91 ans - Duration: 3:33. 
Không có nhận xét nào:
Đăng nhận xét