I got a MSDN document for Array.removeAt() function.
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?
Edit: a.removeAt(a, 2); also not working.
var a = ['a', 'b', 'c', 'd', 'e'];
a.removeAt(a, 2);
console.log(a);
There is no Array.removeAt() function in JavaScript.
MSDN article is an out of date reference to a JScript (not JavaScript) function.
Alternatively you can use Array.splice() or some other similar functions.
For more information check here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With