我在VS Code的调试控制台上遇到了以下错误:
"Uncaught TypeError TypeError: months.toSpliced is not a function"
当我运行这段代码时。
"Uncaught TypeError TypeError: months.toSpliced is not a function"
当我运行这段代码时。
const months = ["Jan", "Mar", "Apr", "May"];
// Inserting an element at index 1
const months2 = months.toSpliced(1, 0, "Feb");
console.log(months2); // ["Jan", "Feb", "Mar", "Apr", "May"]
这甚至不是我的代码,我是从这里复制粘贴的; https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toSpliced
在尝试学习toSpliced()方法时,我遇到了这个错误。
任何帮助将不胜感激。谢谢。