猿问

​javascript 中的delete方法为什么不加括号?

function createhero(name,home,weap) {

this.name = name;

this.home = home;

if (weap == undefined) {

this.weap = 'jian'

}else{

this.weap = weap;

}

this.skill = function(){

alert(this.name+'向敌人发动攻击');

}

}

var hero1  = new createhero('赵日天','断罪小学','刀');

                delete hero1.name;     //为什么不写成delete(hero1.name)


赵日天l
浏览 1336回答 1
1回答
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答