讓人抓狂匪夷所思的4組代碼
下面有4組代碼看似簡單,但是卻另人非常抓狂的,讓人匪夷所思。喜歡研究探索的你快來看看吧……
1.確保這個值等于ture
- if (someBoolean == true) {
- doSomething();
- }
2.只有等于ture時我才return ture
- if (result == true)
- return true;
- else
- return result;
3.我就是不信任if
- if (result <= 10) {
- handling();
- }
- else if (result > 10) {
- otherHandling();
- }
- else {
- handling(); // to be sure
- }
4.要寫出一看就懂的代碼
- function DocumentDotWrite(s){
- document.write(s);
- }
責任編輯:林師授
來源:
外刊IT評論