Javascript (三):Constructor Function
2015-01-20
Constructor function create multiple objects that share certain qualities and behaviors.Constructor function like cookie cutter.Specific constructor function like cookie cutter templdate
Native/Built-in Object Constructor
- Number()
- String()
- Boolean()
- Object()
- Array()
- Function()
- Date()
- RegExp()
- Error()
Array()
Array is Constructor function.
/**
* @param {...*} [args]
* @constructor
* @template T
*/
function Array(args) {}
/**
* @param {...T|Array.} [items]
* @return {Array.}
*/
Array.prototype.concat = function(items) {};
Math
Static object for other methods
// Refer to ECMAScript,as Follows:
Math = {};
/**
* @param {number} x
* @static
* @return {number}
*/
Math.abs = function(x) {};