SemanticsWorks in <code />
About me
  • May 16, 2010

    supplant function

    var template = '<table border="{border}">' +
        '<tr><th>Last</th><td>{last}</td></tr>' +
        '<tr><th>First</th><td>{first}</td></tr>' +
        '</table>';
        
    
    
  • May 15, 2010

    number, string , boolean conversion

    var n = 1;
    var s = "" + n; //number to string
    //or
    String(n);
    //
    n = +s;  //string to number
    //
    n = Number(s); //
    
    
  • May 14, 2010

    javascript split string into array by space

    s.split(/\s+/);
    
  • May 14, 2010

    jQuery queue and deque

    You queue a serial of function, then run the function in a serial.

       var area = document.getElementById("area");
    
    
  • May 13, 2010

    triming leading and trailing whitespace in javascript

    var result = text.replace( /^(\s|\u00A0)+|(\s|\u00A0)+$/g, "" )
    
    
  • 19
  • 20
  • 21

Subscribe

  • Fred Yang

A blog of a frontend developer