javascript array not printing to console properly -


i'm putting dates array, , have second 'tier' in array hold order number associated date. appears working correctly, when print out array in chrome console, see first array of dates. if access manually console.log(datearray[1]['order_number']);, see expected information. have not constructed array properly?

thanks!

    ( var u in valuesarr ) {          //store text seperator between information , order associated         var sep = "?order_num=";          //store string information , order number extracted         var str = valuesarr[u];          //location of seperator         var start = str.indexof("?order_num=");          var order_number = str.substring(start+sep.length);          var current_date = valuesarr[u].substring(0, start);          //date goes "current_date" array         current_date = current_date.split(" / ");          //fashion javascript date         //month needs 1 subtracted         datearray[u] = new date ( current_date[2], current_date[0]-1, current_date[1]);          /*         *to identify order date derives, order_number slot created         *underneath sorted date slot         *this done when html reformatted re-order dates         *the content associated date can 'brought along with'         *as parent div's id contains order number         */         datearray[u]['order_number'] = order_number;      }     console.log(datearray)//only outputs array of dates     console.log(datearray[1]['order_number']);//outputs order number 

what doing datearray[u]['order_number'] = order_number; adding property date object, not adding element array.

to add element array, use:

datearray[u][1] = order_number; 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -