Javascript pushing objects into array changes entire array

前端 未结 8 2362
借酒劲吻你
借酒劲吻你 2020-12-03 08:48

I\'m using a specific game making framework but I think the question applies to javascript

I was trying to make a narration script so the player can see \"The orc hi

8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-03 08:56

    I also had same issue. I had bit complex object that I was pushing in to the array. What I did; I Convert JSON object as String using JSON.stringify() and push in to the Array.

    When it is returning from the array I just convert that String to JSON object using JSON.parse().

    This is working fine for me though it is bit far more round solution. Post here If you guys having alternative options

提交回复
热议问题