javascript - Return Multidimensional Array -
i want return multiply dimensional array function must writing wrong, cant figure out whats wrong. want have key , value pairs.
function multidimensional(){ return [ "one": [ "two":[], "three":[ "testing.png":{source:"http..."} ], "another.png": {source:"http..."} ]; }
if want have key/value pairs, should use an object.
function multidimensional(){ return { "one": { "two":[], "three":{ "testing.png":{source:"http..."} }, "another.png": {source:"http..."} }; } you can access returned data so:
var data = multidimensional(); console.log(data['another.png']); // or console.log(data.one);
Comments
Post a Comment