Arrays of arrays error, "Did you make newArray an array?"


#1

Getting an error that says "Did you make newArray an array?" What am I doing wrong here ladies and gents? Error also says "TypeError: Cannot read property '32' of undefined"

I thought the blocks made it an array?

var newArray = [
    [15,82,19]
    ["attitude","peace","fun"]
    ["fire",45,32]
    ];


#2

Hi @kaehock,

Just a tiny syntax gremlin here; you need to separate each array array from itself, just how you separate each array value... so throw in a comma between each array :slight_smile:

var newArray = [
    [15,82,19], //we use commas 
    ["attitude","peace","fun"], //to separate each array
    ["fire",45,32]
    ];

#3

Aduuhhh!! smh...

Thanks!!!


#4

Hi ,

Its still not working, Below is my code but its saying syntax is incorrect
var myObj = {
name : "Rsdsf"
age : 45;
};

var newArray = [
[15,82,19,],
["attitude","peace","fun", myObj],
["fire",45,32]
];


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.