gpt4 book ai didi

javascript - 为什么我不能将对象添加到以下数组?

转载 作者:行者123 更新时间:2023-11-30 11:31:59 24 4
gpt4 key购买 nike

为什么我不能将对象添加到以下数组?

var userNames = {};
var input = $(this).text();
console.log('input=' + input); //success
userNames.push(input);

最佳答案

var userNames = [];
var input = $(this).text();
console.log('input=' + input); //success
userNames.push(input);

关于javascript - 为什么我不能将对象添加到以下数组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45896056/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com