是否可以使用对象更新集合?我在下面尝试了这个。它不会抛出错误,但它也不会更新。有什么建议?
function checkWord(word) {
var foundFirst = false;
var lengthToChop = 0;
for (var i in word) {
foundFirst = /^[A-Z]/.test( word[i])
if (foundFirst){
lengthToChop = i;
break;
}
}
alert(word.substring(0, lengthToChop));
}