删除操作员密码™不影响JavaScript中数组的长度
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了删除操作员密码™不影响JavaScript中数组的长度相关的知识,希望对你有一定的参考价值。
delete Operator don’t impact the length of Array in javascript
Ref: https://techfiddler.wordpress.com/2015/06/02/delete-operator-dont-impact-the-length-of-array-in-javascript/ var fruits = ["Apple" , "Banana", "Grape", "Litchi", "Mango", "Orange"]; console.log(fruits.length); //prints 6 as there are six elements console.log(fruits[3]); //prints Litchi delete fruits[3]; console.log(fruits.length); //still prints 6 console.log(fruits[3]); //prints undefined
以上是关于删除操作员密码™不影响JavaScript中数组的长度的主要内容,如果未能解决你的问题,请参考以下文章