Thursday 15 March 2012

Checking for a numerical index in a javascript array -


Receiving Image Jason data that is compiled by numerical index For example, when IM in my fall, starting with index 1 Which means that an error in my forloop will be generated because 0 is not present. How do I check whether a numeric index exists in the JavaScript array?

  var a = [1, 2, 3], index = 2; If there is an uncertain item (an [index]! == zero 0) / * zero 0 === undefined * See worry about 'undefined' * / / * The index does not speak to an undefined item. * /}    

No comments:

Post a Comment