Last updated on June 30th, 2018 at 09:50 pm
So let’s go to the browser and see all of this in action.
So I’ll go to Firefox.
Now, I will be using Firefox.
If you don’t have Firefox installed, go to ‘mozilla.org’ and install Firefox.
Watch Full Course >>
And the reason I will be using Firefox is because I want to use Scratchpad.
And to open Scratchpad on Firefox, you’ll just press Shift+F4 on your keyboard.
And this is what I’ll be using for some experimentations of the code and some demonstrations.
So the first thing I want to do here, I’ll just remove this.
If you look at this documentation, you can see, even in Mozilla they use things like console.log to show examples.
But I just want to use, I want to use ‘alert’.
So in my case, I will be using ‘alert’ to show examples.
So once I just say ‘alert’ and I click on run, it will show me the alert here.
So that’s why I want to use it.
I can just do things and test them immediately and if there are any errors, it will also let me know using comments right here on Scratchpad.
So if you want to use Scratchpad as well, you can download Firefox and follow along with me.
So, let’s say we declare a variable.
So you can declare a variable using the ‘var’ keyword.
So var a; So we’ve declared a variable var a; and we haven’t instantiated the variable ‘a’.
So how it works is this.
First of all, you declare the variable, so that the system can know that there is a variable called ‘a’.
And then you give that variable a value.
So in this case I can say, ‘var a’, then I can put it in a different line and say ‘a=4’.
And then, now if I do an alert, ‘alert(a)’, we know that ‘a’ has a value of 4.
So if I alert this, if I run this, it’ll give us the value of 4.
Let me close that one.
So if I run this, it give us that value of 4.
You declare the variable and then you give it an instance.
So in this case, I declare the variable and give it an instance in the same line.
So I can also do the same thing right here.
So if I come here and delete this line and I give this the instance of 4, I give it that value of 4 and then I run it, it’ll give us the same 4.
If I change the value, maybe 1000, then I run, it’ll change the value.
So let’s continue from here in the next video.
Watch Full Course >>