tedshd's DevNote

Develop & Design Note by Ted

Training

Training

F2E 速成

IDE

Sublime or Vim ?
SublimeText2 get start

HTML

CSS

SASS + compass

JavaScript

switch (new Date().getDay()) {
    case 0:
        day = 'Sunday';
        break;
    case 1:
        day = 'Monday';
        break;
    case 2:
        day = 'Tuesday';
        break;
    case 3:
        day = 'Wednesday';
        break;
    case 4:
        day = 'Thursday';
        break;
    case 5:
        day = 'Friday';
        break;
    case 6:
        day = 'Saturday';
        break;
}
  • for
for (i = 0; i < cars.length; i++) { 
    text += cars[i] + '<br>';
}
  • if
if (time < 20) {
    greeting = 'Good day';
}
  • if else
if (time < 10) {
    greeting = 'Good morning';
} else if (time < 20) {
    greeting = 'Good day';
} else {
    greeting = 'Good evening';
}
  • while
while (i < 10) {
    text += 'The number is ' + i;
    i++;
}
typeof('John');                 // Returns string 

typeof(3.14);                   // Returns number

typeof(NaN);                    // Returns number

typeof(false);                  // Returns boolean

typeof([1,2,3,4]);              // Returns object

typeof ({name:'John', age:34});  // Returns object

typeof (new Date());             // Returns object

typeof (function () {});         // Returns function

typeof (myCar);                  // Returns undefined (if myCar is not declared)

typeof (null);                   // Returns object

Jav script xml-httprequest from tysh310246

jQuery

Debug