Variables and Data Types
As soon as we write the simplest program, we have to keep track with pieces of information. We create variables to hold that data. In many programming language, when you create variables, you just don't give it a name, but you must also say exactly type of information that will be stored in that variable. You must decide beforehand is it will store integer, string, or another data type.
You maybe notice in previous example we just use 'var' as data type in javascript. It's because Javascript is weak-typed language. There are strong-type_ _languange, means you not allow to change your variable data type after you choose. You will get error if you put wrong type of value. In the other hand, Javascript only make empty container that we can simply put any type of value in it.
When first we create variable in Javascript, they will have value of 'undefined' until we give it one using assignment operator. The issue of this weak-type language is you can not control what data inputted to the variable. Maybe you make variable 'firstName' expected only string, but people can input number as value.