• jQuery queue and deque

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

       var area = document.getElementById("area");
    
    
  • triming leading and trailing whitespace in javascript

    var result = text.replace( /^(\s|\u00A0)+|(\s|\u00A0)+$/g, "" )
    
    
  • What is javascript

    Here is how Douglas Crockford defined javascript

    Javascript is a functional language with dynamic objects and familiar syntax.

    In his definition, he stressed the most important feature of javascript is functional language(scheme), secondary important feature is dynamic objects(self), the last part is familiar syntax(java). The familiar syntax tend to new javascript developer think that javascript is easy language, but it is not. To really unleash the power of javascript, it is necessary to have deep understanding of functional feature and dynamic objects.

  • adding a new memeber to all objects in javascript

    function Person(){}
    
    
  • How to tell type of an object in javascript

    We can use typeof, instanceof, and constructor to tell type of an object. But they have different effect. The "typeof" operator will return "object" for all custom types . "instanceof" will return true, if the object's constructor is in the list of constructor hierarchy. "constructor" will return the top constructor in the constructor hierarchy. Below is some test code

    function Person() {}
    function Developer(){}
    Developer.prototype = new Person();