Variables Summery
Before we can start digging into the world of functions and objects its really important for us to understand what variables are - this is a quick recap of part 1.
Video Transcript
00:00Congratulations for reaching part two of JavaScript 101.
00:04So we're at JavaScript 102.
00:07All right, so in this stage, what we wanna do
00:09is we're gonna talk about functions
00:11and we're gonna talk about objects.
00:14So I'm all for just getting started.
00:16So if we go back into our code,
00:17I'm gonna refresh our memory.
00:19I created a script here, an external script
00:22called int folder JS slash 01 dash functions dot JS.
00:27And if you open up that file up in your source codes,
00:30you'll find that I'm gonna just start putting here
00:33the files as we go,
00:34cause Adam asked me to do that and that makes sense.
00:37All right, so let's get started.
00:40So I'm gonna go into that source file right now.
00:41It's empty.
00:42I wanna just refresh our memory.
00:43What do we know so far?
00:46We've learned a lot of stuff,
00:47but I wanna focus on things.
00:48So there's a difference between tangible things in code
00:53and helpers.
00:55We've seen a little bit of those helpers already.
00:57I don't wanna focus too much on them
00:58because we haven't really dug too deep into them.
01:02But I just wanna remind us
01:03that we had a few different variable types,
01:04which are things.
01:05They are tangible stuff.
01:08One variable was a number type.
01:10And number, we just call it that and we put a number.
01:15Now obviously, not obviously,
01:16but a reminder variables could contain anything.
01:19So even though we called it a number,
01:21we could have put a string inside or a Boolean inside.
01:24Not encouraged to do that.
01:26So obviously, we encourage you not to do that.
01:29The next one was string.
01:30So S, S-T-R,
01:32because I don't really have a name.
01:34Hello.
01:35And the third one was Boolean.
01:37So we're gonna call this is true.
01:41And we're gonna set it to be true.
01:42So those are the three variables that we learned about.
01:46We said that all these variables are primitive types,
01:48but it's kind of hard to understand what a primitive is
01:51until you actually start saying
01:53what a non-primitive variable is.
01:57So there are actually six different variables in JavaScript.
01:59So we, and that's it.
02:01So we crossed already the middle line.
02:03We learned about three of them.
02:05The next step that I wanna do
02:07is start talking about functions.
02:08Now, we've seen a little bit of functions by,
02:13such as the alert and then putting inside of it a value.
02:16And what that did,
02:17it basically outputted onto the screen an alert box
02:21whenever we would refresh the screen.
02:24Now, an alert is basically a function.
02:26What is a function?
02:27A function is in the most deepest essence
02:30a function's role is to do an action.
02:34It's basically a way for us to tell the computer,
02:37to tell the programming language,
02:39to tell them this is true to any programming language,
02:42to do an operation.
02:43A variable on the other hand
02:45is basically just something that stores data
02:47versus functions are something that does something.
02:51And our scenario alert will then trigger an alert box
02:54that will open up on our window
02:56when we call that and send into it a string or a value.
