JS associative object with duplicate names

前端 未结 8 2037
伪装坚强ぢ
伪装坚强ぢ 2020-12-10 22:51

ok, so I have an object like:

var myobject = {
   \"field_1\": \"lorem ipsum\",
   \"field_2\": 1,
   \"field_2\": 2,
   \"field_2\": 6
};

8条回答
  •  独厮守ぢ
    2020-12-10 23:38

    It is not possible.

    The resulting object does only contain 2 elements, the first and second field_2 elements are lost on creation.

提交回复
热议问题