Animations

API

Arrays

Async

Basics

Challenges

Classes

Console

Dates

Debugging

DOM Elements

DOM Methods

DOM Navigation

DOM Properties

Event Listeners

Flow Control

Forms

Functions

Global Functions

JSON

Keywords

Libraries (3rd party)

Math

Modules

Objects

Snippets

String

Types

Widgets

Window Object

JavaScript - Data Types

JavaScript supports the following data types:

  • numbers
  • strings
  • boolean
  • arrays
  • objects

Strings: All string methods return a new string. They don't modify the original string. Formally said: Strings are immutable: Strings cannot be changed, only replaced.

Arrays: JavaScript arrays are written with square brackets. Array items are separated by commas. Array indexes are zero-based, which means the first item is [0], second is [1], and so on.

var cars = ["Saab", "Volvo", "BMW"];

Objects: JavaScript objects are written with curly braces. Object properties are written as name:value pairs, separated by commas.

var person = {firstName: "John", lastName: "Doe", age: 50, eyeColor: "blue"};