Javascript for Smart People

Data Types

Values of that a programming language supports are called it's data types. Data types are the kinds of data that a program can manipulate. They are the most basic kind of data that a program can use. If you know about the lexical structure of a programming language, then, you have seen examples of number, string, and boolean literals. These types of data are called scalar data. A scalar value is the simplest kind of data that a program can use. Here are some details about these types:

Number

Integers are numbers with an optional sign. If there is no sign, then the number is assumed to be positive. The typical range of values for integers is -2,147,483,648 to 2,147,483,648. This range of values depends on your computer.

0;
-1;

Floating-point numbers respresent approximations of numbers. A floating-point literal is written as a number with a decimal part. The typical range of floating point values is 1.7E-308 to 1.7E308. Again, this range depends on your computer.

Floating-point literals are recognized as numbers with a decimal point, or as numbers written in scientific notation.

0.0
0.0E0

"Values of that a programming language supports are called it's data types."

String

A sting is a sequence of characters. A string can be delimited with single or double quotes. Strings support escape sequences used to represent a literal character in a string. The most common escape sequences are \" and \'.

'It\'s a beautiful day!';
"He said, \" It's a beautiful day!\"";

Most programming languages have an operator for connecting strings. This operation is called concatenation. The operator used to connect strings in Javascript is "+" In PHP it is ".".

'I ' + 'am having fun';

Boolean

A boolean value tells whether a truth value defined by the language is true or false. A value that is not true is false. True and false are the only possible values of the boolean type.

true;
false;