Answer the question
In order to leave comments, you need to log in
How to form such an array in js?
Hello! Guys, help. Question: How to form an array of this format?
var locations = [
['Bondi Beach', -33.890542, 151.274856, 4],
['Coogee Beach', -33.923036, 151.259052, 5],
['Cronulla Beach', -34.028249, 151.157507, 3],
['Manly Beach', -33.80010128657071, 151.28747820854187, 2],
['Maroubra Beach', -33.950198, 151.259302, 1]
];
locations = [];
Answer the question
In order to leave comments, you need to log in
Iterate like this
for (var key in locations) {
var loc = locations[key];
var locName = loc[0];
console.log(locName );
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question