How to get the first element of an array?

How do you get the first element from an array like this:

var ary = ['first', 'second', 'third', 'fourth', 'fifth'];

I tried this:

alert($(ary).first());

But it would return [object Object]. So I need to get the first element from the array which should be the element 'first'.

90 thoughts on “How to get the first element of an array?”

  1. Greetings from California! I’m bored to tears at
    work so I decided to check out your website on my iphone during lunch break.

    I love the knowledge you present here and can’t wait to take a look when I get home.
    I’m amazed at how quick your blog loaded on my phone ..
    I’m not even using WIFI, just 3G .. Anyhow, amazing blog!

    Reply
  2. Hey I know this is off topic but I was wondering if you knew of any widgets I could add
    to my blog that automatically tweet my newest twitter updates.
    I’ve been looking for a plug-in like this for quite some time and was hoping maybe you would have
    some experience with something like this. Please let me know if you run into anything.
    I truly enjoy reading your blog and I look forward to your new
    updates.

    Reply
  3. Hello! I just wanted to ask if you ever have any problems with hackers?

    My last blog (wordpress) was hacked and I
    ended up losing months of hard work due to no back up.
    Do you have any methods to stop hackers?

    Reply
  4. hey there and thank you for your info – I’ve certainly
    picked up anything new from right here. I did however expertise some technical issues using this site, as I experienced to reload the web site lots of times previous to I could get it to load correctly.
    I had been wondering if your web host is OK? Not that
    I’m complaining, but sluggish loading instances times will very frequently affect your placement in google and could damage your quality score if
    ads and marketing with Adwords. Anyway I’m adding this RSS to my email
    and could look out for a lot more of your respective exciting content.
    Ensure that you update this again soon. cheap flights http://1704milesapart.tumblr.com/ cheap flights

    Reply
  5. Wow, fantastic blog structure! How long have you ever been blogging for? you make blogging look easy. The full look of your website is excellent, let alone the content!

    Reply

Leave a Comment