Set dynamic value for array in JS like PHP
My question is how to set the value of an array in JS like PHP? eg: in php I have an array named Arr, I set a new value at n position using
Arr[] = value
but i am trying to do the same in JS but displaying error
+3
Jorge
source
to share
1 answer
Use the push command
Arr.push(value)
+2
Jaime
source
to share