delete 用法总结
// delete 删除
// 语法: boolean delete 数据;
// 在当前作用域上删除数据
// 用法:
// 1, 删除数组中的一个元素
// 2, 删除一个对象的属性或方法
// 3, 删除一个没有用 var 声明 变量
/*
var arr = [ 1, 2, 3, 4 ];
console.log( arr );
console.log( arr.length )
var isTrue = delete arr[ 2 ];
console.log( arr );
console.log( arr.length )
*/
/*
var o = { name: "jim" };
var isTrue = delete o.name; // o[ "name" ]
*/
var n = 1;
m = 2;
var isTrue1 = delete n;
var isTrue2 = delete m;
console.log( isTrue1 ); // => false
console.log( isTrue2 ); // => true
console.log( n ); // => 1
console.log( m ); // => undefined