Reputation: 289
If I have the following code in Javascript:
var line0 = [["2012-07-01",1.8182],["2012-08-01",1.4000],["2012-09-01",1.7500]];
How can I obtain the first date, which in this case is: "2012-07-01"
Thanks in advance.
Upvotes: 1
Views: 2929
Reputation: 32767
You can do it like that:
<script type="text/javascript">
var line0 = [["2012-07-01",1.8182],["2012-08-01",1.4000],["2012-09-01",1.7500]];
alert(line0[0][0]);
</script>
Upvotes: 0
Reputation: 56769
It's the 0
-th element of the array that is the 0
-th element of line0
, so:
line0[0][0]
Upvotes: 4