String, Number, Boolean, Array, Object, Null, Undefined.
A string is a variable which stores a series of characters like "John Doe".
A string can be any text inside quotes. You can use single or double quotes:
You can use quotes inside a string, as long as they don't match the quotes surrounding the string:
You will learn a lot more about strings in the advanced section of this tutorial.
Extra large or extra small numbers can be written with scientific (exponential) notation:
You will learn a lot more about numbers in the advanced section of this tutorial.
Booleans can only have two values: true or false.
Booleans are often used in conditional testing. You will learn more about conditional testing in a later chapter of this tutorial.
The following code creates an Array called cars:
or (condensed array):
or (literal array):
Array indexes are zero-based, which means the first item is , second is , and so on.
You will learn a lot more about arrays in later chapters of this tutorial.
An object is delimited by curly braces. Inside the braces the object's properties are defined as name and value pairs (name : value). The properties are separated by commas:
The object (person) in the example above has 3 properties: firstname, lastname, and id.
Spaces and line breaks are not important. Your declaration can span multiple lines:
You can address the object properties in two ways:
You will learn a lot more about objects in later chapters of this tutorial.
Undefined is the value of a variable with no value.
Variables can be emptied by setting the value to null;
When you declare a new variable, you can declare its type using the "new" keyword:
Your message has been sent to W3Schools.