Javascript Array Alert

前端 未结 1 1131
执笔经年
执笔经年 2020-12-23 14:51

Im new to Javascript.

Im trying to code these four buttons. I\'m currently on the second one. I\'ve coded an array. But when I click on the button, it replaces the p

相关标签:
1条回答
  • 2020-12-23 15:17

    If you want to see the array as an array, you can say

    alert(JSON.stringify(aCustomers));
    

    instead of all those document.writes.

    http://jsfiddle.net/5b2eb/

    However, if you want to display them cleanly, one per line, in your popup, do this:

    alert(aCustomers.join("\n"));
    

    http://jsfiddle.net/5b2eb/1/

    0 讨论(0)
提交回复
热议问题