プログラミングの達人と初心者の違い
1350 ワード
1.計算システムは今何曜日ですか?
野菜の鳥:var str="var week=new Date().getDay()eif(week==0){str=今日は日曜日です.}else if(week==1){str=今日は月曜日です.}else if(week==2){str=今日は火曜日です.}else if(week==3){str=今日は水曜日です.=weeeeifee=========================5)Estreeeeeeeeeeiiiiif(今日は今日は5=======================================================if(week==6){str=今日は土曜日です.;
中間層:var a=[日],“一”,“二”,“三”,“四”,“五”,“六”;var week=new Date().getDay()var str=「今日は日曜日」+a[week]consolie.logs(str)
达人:var str=「今日は月曜日」+「日一二三五六」.charAt(new Date).getDay();
2.配列オブジェクトのある属性のマッピング初心者:
var a 1={id:「0001」、plceCode:'sh'、value:0.5'、{id:「0002」、placCode:'sz'、value:1.5}、{id:「0003」、placCode:'sh'、value:2.5}
達人:var toStr={sh:'上海'、sz:'深さ';var a 2=$map(a 1,function(obj,key){var place Code=obj.placceCode;obj.placceCode=toStar[placCode]?toStr[placCode]:placCode;return obj;
野菜の鳥:var str="var week=new Date().getDay()eif(week==0){str=今日は日曜日です.}else if(week==1){str=今日は月曜日です.}else if(week==2){str=今日は火曜日です.}else if(week==3){str=今日は水曜日です.=weeeeifee=========================5)Estreeeeeeeeeeiiiiif(今日は今日は5=======================================================if(week==6){str=今日は土曜日です.;
中間層:var a=[日],“一”,“二”,“三”,“四”,“五”,“六”;var week=new Date().getDay()var str=「今日は日曜日」+a[week]consolie.logs(str)
达人:var str=「今日は月曜日」+「日一二三五六」.charAt(new Date).getDay();
2.配列オブジェクトのある属性のマッピング初心者:
var a 1={id:「0001」、plceCode:'sh'、value:0.5'、{id:「0002」、placCode:'sz'、value:1.5}、{id:「0003」、placCode:'sh'、value:2.5}
var newValue;
var a2 = $.map(a1, function(obj,key){
if (obj.placeCode == "sh") {
newValue = " ";
} else if (obj.placeCode == "sz"){
newValue = " ";
}
return ($.extend(obj,{value:newValue}));
});
中間層:var maps=new Map(''sh'、上海'、''sz'、'深')var a 2=$map(a 1,function(obj,key){obj.placceCode=maps.get(obj.placceCode);return obj;達人:var toStr={sh:'上海'、sz:'深さ';var a 2=$map(a 1,function(obj,key){var place Code=obj.placceCode;obj.placceCode=toStar[placCode]?toStr[placCode]:placCode;return obj;