📜  javascript 动态数组 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:30.310000             🧑  作者: Mango

代码示例1
var input = []; // initialise an empty array
var temp = '';
do {
    temp = prompt("Enter a number. Press cancel or leave empty to finish.");
    if (temp === "" || temp === null) {
        break;
    } else {
        input.push(temp);  // the array will dynamically grow
    }
} while (1);