& quot;未捕获的TypeError:Array.removeAt()不是函数& quot ;, [英] "Uncaught TypeError: Array.removeAt() is not a function",
问题描述
我得到了 Array.removeAt()的MSDN文档功能.
但是当我尝试它时,出现此错误:未捕获的TypeError:Array.removeAt不是函数",
But when i trying it, I am getting this error : "Uncaught TypeError: Array.removeAt is not a function",
var a = ['a', 'b', 'c', 'd', 'e'];
Array.removeAt(a, 2);
console.log(a);
为什么它在这里不起作用?那是一个错误的文件吗?
Why it's not working here? And is that is a wrong document?
a.removeAt(a,2);
也不起作用.
var a = ['a', 'b', 'c', 'd', 'e'];
a.removeAt(a, 2);
console.log(a);
推荐答案
在
There is no Array.removeAt()
function in JavaScript.
MSDN文章是对JScript(不是JavaScript)的过时引用功能.
MSDN article is an out of date reference to a JScript (not JavaScript) function.
或者,您可以使用 Array.splice()
或其他一些类似的功能.
Alternatively you can use Array.splice()
or some other similar functions.
有关更多信息,请参见此处: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/splice
For more information check here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice
这篇关于& quot;未捕获的TypeError:Array.removeAt()不是函数& quot ;,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!