& quot;未捕获的TypeError:Array.removeAt()不是函数& quot ;, [英] "Uncaught TypeError: Array.removeAt() is not a function",

查看:50
本文介绍了& quot;未捕获的TypeError:Array.removeAt()不是函数& quot ;,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了 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);

推荐答案

Array.removeAt()函数-US/docs/Web/JavaScript/Reference/Global_Objects/Array"rel =" nofollow noreferrer> JavaScript .

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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆