原生JS实现例三 求大神解答
原生JS实现例三 求大神解答
原生JS实现例三 求大神解答
2017-01-15
var x = 1;
if(x == "1") {
console.log("YAY! They're equal!");
}
var x = 1;
// 严格平等,类型必须相同
if(x === "1") {
console.log("Sadly, I'll never write this to the console");
}
if(x === 1) {
console.log("YES! Strict Equality FTW.")
}
var doSomething = function(doWhat) {
switch(doWhat) {
case "doThisThing":
// more code...
break;
case "doThatThing":
// more code...
break;
case "doThisOtherThing":
// more code....
break;
// additional cases here, etc.
default:
// default behavior
break;
}
}
举报