How to create an Array?
Create an array named data and store any 3 numbers in it.
I created an array and stored 3 numbers inside. I checked my work and got this message; Bummer! There was an error with your code. Syntax error; parse error.
What am I doing wrong?
var data = [ '7' '15' '26' ];
Jennifer NordellTreehouse Staff
Close! Really close... but not quite. First, the elements in your array need to be separated by commas. But secondly and most importantly... those aren't numbers. I know... I know... they look like numbers, but because they are in quotes they're now strings. They are the kind of numbers we might use in a street address, telephone number, or social security number. It's nothing we would ever do any mathematical operations on. I've reformatted your array so it works. Take a look:
var data = [7, 15, 26];