1.return "hello"+(who?","+who:"");
这行代码是判断who是否为空吗?没见过这个语法
2.var type=""
function Block(){
this.new=function(){
type=type||"B1";
}
this.transform=function(type){
switch(type){
case "B1"://变纵向
type="B2";
break;
case "B2"://变横向
type="B1";
break;
}
}
}
var b=new Block();
var c=b.new();
var a=b.transform(type);
alert(type);
b.transform(type);
alert(type);
为什么b.transform(type)不能把全局变量中的B1改为B2
这插入代码片段为什么没有格式...
直接贴代码吧,希望能看懂。希望以后发问题时代码能够整理下吧
1.
2.