8

My question is how I will set a value an array in JS like PHP? for example: in php I have an array named Arr, I set a new value in n position using

Arr[] = value

but I try to do same in JS but display an error

2
  • By the way, google is your friend, searching 'javascript array': w3schools.com/jsref/jsref_obj_array.asp Commented Jun 2, 2015 at 21:14
  • @Jorge you have answers, try them. which one looks more elaborated and useful mark as an answer . thanks. Commented Jun 2, 2015 at 21:24

1 Answer 1

5

Use the push command

Arr.push(value)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.