Object property name as number

前端 未结 6 698
盖世英雄少女心
盖世英雄少女心 2020-11-22 16:20

According to the official JavaScript documentation you can define object literal property names using integers:

Additionally, you can use a numeric or

6条回答
  •  广开言路
    2020-11-22 17:01

    You can reference the object's properties as you would an array and use either me[123] or me["123"]

提交回复
热议问题