Muhammad Raheel
Muhammad Raheel

Reputation: 19882

Extract values from Javascript Array

I need to extract Asia from this array. How can i do that. Here is a sample array? This is javascript. i need to extract Asia from first index. Help required.

var myData = new Array(['Asia', 437, 520],['Middle East', 20, 31],['Aus/Oceania', 19,21]);    

Upvotes: 0

Views: 1267

Answers (5)

Mustafa Amin
Mustafa Amin

Reputation: 70

You could access it via myData[0][0]

Upvotes: 1

Pranav
Pranav

Reputation: 8871

myData[0][0] will work or else you can try like this

var myData = new Array(['Asia', 437, 520],['Middle East', 20, 31],['Aus/Oceania', 19,21]);
var arr=myData[0];
var spl=arr.shift();
alert(spl); 

Upvotes: 0

Arun P Johny
Arun P Johny

Reputation: 388316

myData[0][0] will give you Asia.

Upvotes: 0

slash197
slash197

Reputation: 9034

Have you tried myData[0][0] and doesn't work?

Upvotes: 0

Oscar Broman
Oscar Broman

Reputation: 1127

You could access it via myData[0][0] if that's what you mean.

Upvotes: 0

Related Questions