In PHP , I can add a value to the array like this:
array[]=1;
array[]=2;
and the output will be 0=>'1', 1=>'2';
And if I tried the same code in javascript , it return Uncaught SyntaxError: Unexpected string . So , is there any way in JS to work the same as PHP? Thanks
Simply use
Array.pushin javascriptArray.push on MDN