Learn Create Your Own Split Screen

Next Page

Javascript has the same idea, but much more powerful.

In Javascript, lists are called Arrays (same in most other programming languages), and they are specified using square brackets. Here's an example:

var MyArray = ["banana", "orange", "grape", "watermelon", "peach"]
The items in an array are called elements. The sample above has strings for elements, but you can put anything in your array -- numbers, booleans, even other arrays.

The number that you use to access a particular element is called an index.

The big difference is that in Scratch, the first element is index number one, but in Javascript, it's index number zero.

Here's that same Scratch program, but written in Javascript. When you run it, remember case matters.