02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

What are Variables?

Variables are the building blocks of the programming world. Take any programming language and the basic elements, the building blocks, will be variables. You can also think of variables as buckets which can store data. When we move further along in this course you will get to know variables a lot better as our usage of them increases. .

Data type” mean the type of data (such as numbers or text) which we can use while programming. There are 3 primitive data types (we don't mean data painted on a cave wall by a Neanderthal!) Primitive means the most basic types which JavaScript stores in a special way to make retrieval as fast as possible. Complex data types, such as arrays or objects, take longer to store and retrieve – but they also contain more data. Primitives exist in almost every language. Here are the three JavaScript uses:

  1. STRING: Strings are where we can store any copy -- it can be a name, an address etc, any text. We will explore and learn more about strings in a later video. Here is an example:
    var strAddress = “2929 White House Way”;

  2. NUMBER: if the name doesn't give it away, here is a hint: it has something to do with numbers! This data type stores numeric digits of any kind (real, integers, negatives and positives.) Throughout the next few videos we will apply various Math operations on numbers. Here's a fast example:
    var nMonth = 12;

  3. BOOLEAN variables which can either be "true" or "false." No other value can be contained in one. Look at this statement, "you broke this window." This can either be true or false: that’s what the Boolean data type is used for. We store true or false information in it and it's usually used for flags to check whether we should take a decision or not. Booleans will prove to be a great asset in your tool belt, about which we will learn as we progress in this course. Here's a fast example:
    var isBroken = false;

Coming up next..

In the next video we will begin playing with these data types while coding in JavaScript.

Video Transcript

00:00So I want to look again for one second and see we created here two things and I'm looking back
00:04into that sample in our home.js. First of all we created some sort of action which was an alert
00:10that action then we sent some information and that information will then send to that box that we've
00:16seen and created that alert message. Now we learned quite a lot of things here and we're going to
00:20revisit that in a minute after we learn a couple of new stuff which will then explain all these
00:25stuff what we've just did right here. So the first thing I want to talk about are variables.
00:29A variable is basically a bucket of information. We're talking in text obviously in a programming
00:35language so everything we input into the computer we have to input it in a way that the computer
00:39could understand and there are three different basic types of data which in programming we call
00:44that primitive data types and primitive data types is basically means is the most basic
00:49constructions. As we said later on we're going to learn about objects and about things that belong
00:54to things but before you even get to that we have to start with the with the most essential
00:58the most basic elements in a programming language. Every programming language has different essential
01:04basic building blocks and in javascript there are three basic building blocks one of them is a
01:10string which basically represents copy another one is the number which represents numbers which
01:16will use math with them and the third one is a boolean value which basically represents true or
01:21false true or false that was true or false which basically means that it's or true or false or yes
01:30or no and those are really those three basic data types I don't want to show them to you in action.

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!