let numArr2 = [1, 2, 3, 4, 5, 6, 7];
numArr2.splice(1, 1);
console.log(`Length of the numArr2 is ${numArr2.length()}`);
为什么这段代码没有显示
numArr2
的长度?
长度是一个正确的值,而不是一个方法,请删除括号。
let numArr2 = [1, 2, 3, 4, 5, 6, 7];
numArr2.splice(1, 1);
console.log(`Length of the numArr2 is ${numArr2.length}`);