I am new to JS and would like to ask a way to modify a variable of an object from an array of objects in twine using javascript.
<<set $testArray = []>> <<set $testArray.push( { name: '', ID: 12 } )>>
So it's time for JS and HTML textbox.
I answered your original question explaining what's wrong and how to work around it.
As far as your question here goes. You may use State.variables to access your story variables within JavaScript. For example, $myArray would be:
State.variables.myArray
Similarly, temporary variables may be accessed via State.temporary. For example, _myTempValue would be:
State.temporary.myTempValue
Well, I had just answered, so it hadn't been there long. :)
PS: I edited my answer above to add some of the information you're looking for.