Javascript pushing object into array

前端 未结 4 2430
無奈伤痛
無奈伤痛 2021-02-20 05:26

Hey, I currently am having trouble trying to get this to work. Here\'s a sample code of what I am trying. A lot has been taken out, but this should still contain the problem. I

4条回答
  •  滥情空心
    2021-02-20 06:15

    I would do

    player = [];
    

    instead of

    player = new array();
    

    As a sanity check, try doing:

    document.write("Name: " + player[0].name);
    

提交回复
热议问题