tracks

Codecademy

Sign in Sign up
Ajax-loader-large-white
9/25
More Fun with Arrays
Multi-whats?

The plain old arrays we've been talking about can store just about anything. We've been using them to create lists of strings so far, but that's just the tip of the iceberg.

You can put any javascript data type in an array. That includes strings, numbers, objects, functions, and even other arrays!

The following is a perfectly valid array:
var myArray = ["hello", 45, [1,2,3,4] ];

Woah! The first item is a string and the second is a number, but the last one is an array.

Instructions

Imagine we have 2 players in a game of poker. How would we store the value of each player's hand in an array. Complete the code to find out.

script.js
Back to Editor

Sign in