Check if an array item is set in JS

Posted by Gusepo on Stack Overflow See other posts from Stack Overflow or by Gusepo
Published on 2010-04-10T11:29:39Z Indexed on 2010/04/10 11:33 UTC
Read the original article Hit count: 332

Filed under:
|
|

Hi, I've got an array

    var assoc_pagine = new Array();
    assoc_pagine["home"]=0;
    assoc_pagine["about"]=1;
    assoc_pagine["work"]=2;

I tried

    if (assoc_pagine[var] != "undefined") {

but it doesn't seem to work

I'm using jquery, I don't know if it can help

Thanks

© Stack Overflow or respective owner

Related posts about js

Related posts about isset