AS3数组按索引删除

10

我有一个数组 'cat', 'dog', 'budgie'

想要通过索引删除其中的项。

目前我的代码是:

function removeit(myindex) {
    animals[myindex] = animals.pop()
}

你是指animals[myindex] = null吗?你想要最终的结果是什么? - Sam DeHaan
如果我传入'猫,我想要它变成'狗','鹦鹉'。我可以从函数中移除我传入的项目。 - LeBlaireau
6
如果你将答案标记为正确,人们将更倾向于在未来帮助你。 :) - francis
2个回答

34

6

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接