我正在使用 id 从 DOM 中提取一个输入元素数组,并使用 .map() 循环遍历数组。我的代码有效,但是 currentValue 和 index 被切换了:ports = $("#edit_display_control_ports > li > input").map(function(currentValue, index){ return index.value;}).toArray(); 同样,此代码有效。根据文档,map() 函数的第一个参数应该是 currentValue,第二个参数应该是 index。但是我必须切换两者。currentValue 返回数组的索引,而 index 参数返回元素。
添加回答
举报
0/150
提交
取消