Download the free Grasshopper app
Toggle

Data Types

Every programming language has its own built-in data types. The data types in JavaScript include numbers, strings, booleans, arrays, and objects.


Number

In JavaScript, numbers can be whole (such as 10) or contain a decimal (such as 10.5).

Learn More


String

Strings store text, such as letters, words, symbols, and spaces. Strings are surrounded by quotation marks.

Learn More


Boolean

A boolean stores the value true or false.

Learn More


Array

An array is a list containing multiple items. The items can be different data types: numbers, strings, and even other arrays. An array inside another array is called a nested array.

Learn More


Array Indexing

Array indexing provides a way to access a specific item in an array. In most programming languages, including JavaScript, array indices start at 0. For example, the first item in an array is at index 0, the second item is at index 1, etc.  

Learn More


Object

An object stores an unordered list of properties. Each property is a key:value pair. The key stores the property's name. The value can be any data type, such as a number, string, array, or even another object.

Learn More


Object Dot Notation

Dot notation is one way to access a property of an object. To use dot notation, write the name of the object, followed by a dot (.), followed by the name of the property.

Learn More


Object Bracket Notation

Bracket notation is another way to access a property of an object. To use bracket notation, write the name of the object, followed by brackets []. Inside the brackets, write the property name as a string.

Learn More


Undefined

When a variable has not been assigned a value, its value is undefined.

Learn More