What is the javascript equivalent of the PHP auto-assigning array feature?

jmedina12

New Member
I am trying to automatically update a javascript array, without specifying a number or string for the key. The value should just take up the next numeric key in the array.In php you can do this:\[code\]<? myarray = array();myarray[] = '1';myarray[] = '2';myarray[] = '3';//this is equivalent to myarray[1] = '1', myarray[2] = '2', myarray[3] = '3'; ?>\[/code\]how can I do this in javascript?this throws an error\[code\]$(function(){var optionset = []; optionset[] = 'a';optionset[] = 'b';}); \[/code\]
 
Back
Top