We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
over > 0
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1、大佬这里的 over 需要 over > 0 吧?
let over = addCount - delCount; if(over) { // 向后移
2、这块的逻辑处理好像不太对(稀疏数组也存在类似情况)。
} else if (over < 0) { // 向前移 for(let i = startIndex + delCount; i <= array.length - 1; i++) { if(i + Math.abs(over) > array.length - 1) { // 删除冗于元素 delete array[i] continue } array[i] = array[i + Math.abs(over)] } } }
例如:
var arr = [1,2,3,4,5]; arr.splice(0, 3, 6, 7); console.log(arr); // - 预期结果:[6, 7, 4, 5] - 实际结果:[6, 7, 3, 5]
Originally posted by @MeetTheBest in #138 (comment)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
1、大佬这里的 over 需要
over > 0
吧?2、这块的逻辑处理好像不太对(稀疏数组也存在类似情况)。
例如:
Originally posted by @MeetTheBest in #138 (comment)
The text was updated successfully, but these errors were encountered: