If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Course: Unlisted resources area > Unit 2

Lesson 1: ProcessingJS documentation

Arrays

In JavaScript, an array is a way to store many values inside one variable.
To create an array, you initialize it with some values:
var array = ["a", "b", "c", "d"];
To get an element in an array, you need to access it by its index, like this: array[3]
Arrays are 0-indexed, which means the first element in an array is found at array[0]. And the last element in an array of size n is found at array[n-1].
You can get the length of an array by typing array.length

Want to join the conversation?

No posts yet.