讓人抓狂的代碼

jopen 12年前發布 | 5K 次閱讀 代碼

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評論

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!