As a changed property of an object to leave in the same place?

I have the usual object.
obj = {
test: 'testttt',
test1: 'testttt1'
}


how do I change the property test to test3 so that it remaining at the same place, and in the end adds. Creating a new object is not suitable, because the object is very large
July 4th 19 at 23:19
3 answers
July 4th 19 at 23:21
Why? An object is an unordered array, of here and must dance.

upd:
I if you change the property, it does not come to an end. But again, this is no guarantee, and not the fact that in another browser/computer is not there.
How do You change the property? I just have to change the usual delete the old and create something new, so I in the end throws new - dahlia_Bog commented on July 4th 19 at 23:24
that's what I do stackoverflow.com/questions/8483425/change-propert... but I can't do this - dahlia_Bog commented on July 4th 19 at 23:27
: codepen.io/anon/pen/YGGArR?editors=1111 - beatrice_Hamill1 commented on July 4th 19 at 23:30
: so what will break if the position of the object will change? - beatrice_Hamill1 commented on July 4th 19 at 23:33
: You just don't understand) I change not the value, and the property itself. ie in your example it is necessary to change the key value(ie test) on something. - dahlia_Bog commented on July 4th 19 at 23:36
July 4th 19 at 23:23
And what is this whole thing?
You iterate through the fields in a loop and you want a specific order?
no I'm not sorted, I write functional changes to the json. Json represent object and deduce as a tree. Any of the properties or values of this tree can be changed - dahlia_Bog commented on July 4th 19 at 23:26
So what's the problem? Output in the text field (e.g. textarea) and edit in any sequence. If you write the visual editor, the order of the properties will depend entirely on your code. - dahlia_Bog commented on July 4th 19 at 23:29
ie, you need to watch the logic of your code, where and why in the end he adds the changed properties of object - beatrice_Hamill1 commented on July 4th 19 at 23:32
July 4th 19 at 23:25
You have chosen a wrong structure for storing tree
It must be something like this:
{
 "name": "Root",
 "childs": [
 { 
 "name": "First" 
},
 { 
 "name": "Second",
 "childs": [{...} , {...}, {...}]
},
 { 
 "name": "Third"
}
 ] 
}

and try to set the properties in the right order - it's wrong
Well, Yes, I think I understand what You mean. Just the problem is that I have comes the usual JSON and I have it in the object translation. And then just immediately start this object to parse. And in your variant I have to create this structure first, and then only to start it out. Ie I think that in terms of the conclusion time will increase. Of course maybe I have lame conclusion structure because of a large json render things for a long time(for two seconds and freezes the browser) - dahlia_Bog commented on July 4th 19 at 23:28

Find more questions by tags JavaScript