How can I modify an element of an array? [closed]

I have a simple array like this one:

myArray = {1, 2, 17}


At some point I want that 2 to be a 4. How can I change it?

closed as off-topic by mikado, Edmund, march, m_goldberg, Henrik SchumacherOct 24 '18 at 15:03

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – mikado, Edmund, march, m_goldberg, Henrik Schumacher
If this question can be reworded to fit the rules in the help center, please edit the question.

• you can use Replace or ReplacePart... – J42161217 Oct 23 '18 at 18:05
• myArray[[2]] = 4;. – AccidentalFourierTransform Oct 23 '18 at 18:13
• myNewArray = MapAt[4 &, myArray, 2] – user1066 Oct 23 '18 at 19:53