Ref:http://www.w3schools.com/js/js_comparisons.asp
var r = 1;
var result = r || 2;
console.log(result);
//output: 1 r = 0;
result = r || 2;
console.log(result);
//output: 2 r = 0;
result = r || "string";
console.log(result);
//output: string
2023-08-05 17:47:28
Ref:http://www.w3schools.com/js/js_comparisons.asp
var r = 1;
var result = r || 2;
console.log(result);
//output: 1 r = 0;
result = r || 2;
console.log(result);
//output: 2 r = 0;
result = r || "string";
console.log(result);
//output: string
下一篇:Linux知识总结(更新中)