The internal function String, Number and Boolean are the wrapper object constructors of primitive data.
    String(...)        // convert anything to string
    new String(...)    // construct a wrapper object of string

One is string and another one is object, that can be verified by typeof keyword:
    var str = String(10);
    var str2 = new String(10);
    debug.assert( typeof str == 'string' );        // str is string
    debug.assert( typeof str2 == 'object' );       // str2 is object

But in anytime, you may use valueOf method convert a wrapper object into its primitive data:
    var str = str2.valueOf();
    debug.assert( typeof str == 'string' );

Number and Boolean are the same as String.

Last edited Jul 11, 2013 at 1:06 AM by unvell, version 1