0

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]); 
evilone
22.8k8 gold badges85 silver badges112 bronze badges
asked Mar 22, 2012 at 11:36
1
  • 5
    Read a JavaScript tutorial, especially about arrays. Make sure you understand at least the basics of a language before you do anything else. Commented Mar 22, 2012 at 11:40

5 Answers 5

1

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

answered Apr 7, 2012 at 10:43
Sign up to request clarification or add additional context in comments.

Comments

0

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); 
answered Mar 22, 2012 at 11:45

Comments

0

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

answered Mar 22, 2012 at 11:38

Comments

0

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

answered Mar 22, 2012 at 11:39

Comments

0

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

answered Mar 22, 2012 at 11:39

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.