Data Types

Data types are a way of categorizing different types of variables inside of a computer program. JavaScript is what is referred to as a weakly typed programming language. What this means is that when declaring a variable you don’t have to declare what type of variable it is. This is great for you because you don’t have to worry too much about managing all of this because it all happens in the background. That said it’s still a good idea to understand what a data type is.

How computers store variables.

You’ve probably heard the term “binary” before in relation to computers. What this means is that computers store information as either 0’s or 1’s. For the most part we use the decimal numbers 0 - 9 to store numbers. So how does a computer store the number 9? We’ll look at this more in depth later, but for now, let’s just say that the computer converts this number to the binary value (1001) and then stores it in memory.

Types of Variables

This is all well and good for positive integers, but what if we want to store a negative number? Since there are only 0’s and 1’s we can’t just put a negative sign in front of a number. What about the letter ‘k’ or the number 2.39925? While the actual way in which these things are encoded is beyond the scope of this unit, we will look at the next level higher abstraction.

When programming languages first started to be written, programmers needed a way of telling the computer how to store these variables by defining ahead of time what the data type was so that they could be properly encoded, and retrieved. Below is a list of some of the basic data types from a programming language called C.

data types

http://apprize.info/programming/arduino/6.html

As I mentioned above, JavaScript is an untyped language, which means that the programming language can figure out what the variable type is based on the value assigned to the variable, but it’s still valuable to know about them.

Video Explanation

This video talks about how data types are used in writing code for an Arduino, which is a type of micro controller. We’ll look at what this is later but for now this is a good Explanation

CC Data Types


Previous section:
Next section: