JavaScript push to array

前端 未结 5 907
离开以前
离开以前 2020-12-07 20:12

How do I push new values to the following array?

json = {\"cool\":\"34.33\",\"alsocool\":\"45454\"}

I tried json.push(\"coolness\":\"

5条回答
  •  时光说笑
    2020-12-07 20:51

    object["property"] = value;
    

    or

    object.property = value;
    

    Object and Array in JavaScript are different in terms of usage. Its best if you understand them:

    Object vs Array: JavaScript

提交回复
热议问题