ITSE 1411 Beginning Web
JS Variables Module 2 Discussion
Discussion
JavaScript Variables
- JavaScript Data Types
- Variables are assigned values. There are five types of values in JavaScript that the variables represent:
- Number - numbers are of two different types:
- Integers - whole numbers with no decimal points.
- Float numbers - numbers with a decimal point.
- Boolean - a logical value that is either true or false.
- String - text.
- Undefined - a variable that has been declared but has not been defined (assigned a value).
- Null - an empty value. (In JavaScript you actually assign the reserved word "null".) For example:
var myName = "null";
- JavaScript is loosely typed meaning that a variable can be assigned different types.
var myVariable = "Hello World";
myVariable = 6