JS创建类以及类的方法(StringBuffeer类)

创建StringBuffer类以及toString,append()方法

 //创建一个StringBuffer类 ,此类有两个方法:一个是append方法一个是toString方法
    function StringBuffer() {
      this.__strings__ = [];
    };
    StringBuffer.prototype.append = function(str) {
      this.__strings__.push(str);
    };
    StringBuffer.prototype.toString = function() {
      return this.__strings__.join(‘‘);
    };

  创建Object对象的方法

/*******************************************************************************
 * Copyright (c) 2008, 2010 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 ******************************************************************************
* Please see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html
*/

/**
  * Object Object()
  * @constructor
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
function Object(){};
 /**
  * function toString()
  * @memberOf   Object
  * @returns {String}
  * @see     Object
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Object.prototype.toString = function(){return "";};
 /**
  * function toLocaleString()
  * @memberOf   Object
  * @returns {String}
  * @see     Object
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Object.prototype.toLocaleString = function(){return "";};
 /**
  * function valueOf()
  * @memberOf   Object
  * @returns {Object}
  * @see     Object
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Object.prototype.valueOf = function(){return new Object();};
 /**
  * function hasOwnProperty(name)
  * @memberOf   Object
  * @param   {String} name
  * @returns {Boolean}
  * @see     Object
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Object.prototype.hasOwnProperty = function(name){return true;};
 /**
  * function isPrototypeOf(o)
  * @memberOf   Object
  * @param   {Object} o
  * @returns {Boolean}
  * @see     Object
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Object.prototype.isPrototypeOf = function(o){return true;};
 /**
  * function propertyIsEnumerable(name)
  * @memberOf   Object
  * @param   {Object} name
  * @returns {Boolean}
  * @see     Object
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Object.prototype.propertyIsEnumerable = function(name){return true;};
/**
  * Property constructor
  * @type  Function
  * @memberOf Object
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Object.prototype.constructor = new Function();

/**
  * Object String()
  * @constructor
  * @extends Object
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
function String(){}
String.prototype = new Object();
/**
  * static function fromCharCode(charCode1, ...)
  * @memberOf   String
  * @param {Number} charCode
  * @returns {String}
  * @static
  * @see     String
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
String.fromCharCode = function(charCode){return "";};
/**
  * Property length
  * @type    Number
  * @memberOf   String
  * @see     String
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
String.prototype.length = 1;
 /**
  * function charAt(position)
  * @memberOf   String
  * @param   {Number} position
  * @returns {String}
  * @see     String
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
String.prototype.charAt = function(position){return "";};
 /**
  * function charCodeAt(position)
  * @memberOf   String
  * @param   {Number} position
  * @returns {Number}
  * @see     String
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
String.prototype.charCodeAt = function(position){return 0;};
 /**
  * function concat(value1, ...)
  * @memberOf   String
  * @param {String} value
  * @returns {String}
  * @see     String
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
String.prototype.concat = function(value){return "";};
 /**
  * function indexOf(searchString, startPosition)
  * @memberOf   String
  * @param   {String} searchString
  * @param   {Number} startPosition
  * @returns {Number}
  * @see     String
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
String.prototype.indexOf = function(searchString, startPosition){return 1;};
 /**
  * function lastIndexOf(searchString, startPosition)
  * @memberOf   String
  * @param   {String} searchString
  * @param   {Number} startPosition
  * @returns {Number}
  * @see     String
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
String.prototype.lastIndexOf = function(searchString, startPosition){return 1;};
 /**
  * function localeCompare(otherString)
  * @memberOf   String
  * @param   {String} otherString
  * @returns {Number}
  * @see     String
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
String.prototype.localeCompare = function(otherString){return 0;};
 /**
  * function match(regexp)
  * @memberOf   String
  * @param   {RegExp} regexp
  * @returns {Array}
  * @see     String
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
String.prototype.match = function(regexp){return [];};
 /**
  * function replace(regexp, replaceValue)
  * @memberOf   String
  * @param   {RegExp} regexp
  * @param   {String} replaceValue
  * @returns {String}
  * @see     String
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
String.prototype.replace = function(regexp, replaceValue){return "";};
 /**
  * function search(regexp)
  * @memberOf   String
  * @param   {RegExp} regexp
  * @returns {Number}
  * @see     String
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
String.prototype.search = function(regexp){return 1;};
 /**
  * function slice(start, end)
  * @memberOf   String
  * @param   {Number} start
  * @param   {Number} end
  * @returns {String}
  * @see     String
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
String.prototype.slice = function(start, end){return "";};
 /**
  * function split(separator, limit)
  * @memberOf   String
  * @param   {String} separator
  * @param   {Number} limit
  * @returns {Array}
  * @see     String
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
String.prototype.split = function(separator, limit){return [];};
 /**
  * function substring(start, end)
  * @memberOf   String
  * @param   {Number} start
  * @param   {Number} end
  * @returns {String}
  * @see     String
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
String.prototype.substring = function(start, end){return "";};
 /**
  * function toLowerCase()
  * @memberOf   String
  * @returns {String}
  * @see     String
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
String.prototype.toLowerCase = function(){return "";};
 /**
  * function toLocaleLowerCase()
  * @memberOf   String
  * @returns {String}
  * @see     String
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
String.prototype.toLocaleLowerCase = function(){return "";};
 /**
  * function toUpperCase()
  * @memberOf   String
  * @returns {String}
  * @see     String
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
String.prototype.toUpperCase= function (){return "";};
 /**
  * function toLocaleUpperCase()
  * @memberOf   String
  * @returns {String}
  * @see     String
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
String.prototype.toLocaleUpperCase = function(){return "";};

/**
  * Object Number()
  * @constructor
  * @extends Object
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
function Number(){}
Number.prototype = new Object();
/**
  * property MIN_VALUE
  * @type Number
  * @memberOf Number
  * @static
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Number.MIN_VALUE = 0;
/**
  * property MAX_VALUE
  * @type Number
  * @memberOf Number
  * @static
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Number.MAX_VALUE = 0 ;
/**
  * property NaN
  * @type Number
  * @memberOf Number
  * @static
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Number.NaN = 0;
/**
  * property NEGATIVE_INFINITY
  * @type Number
  * @memberOf Number
  * @static
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Number.NEGATIVE_INFINITY = 0;
/**
  * property POSITIVE_INFINITY
  * @type Number
  * @memberOf Number
  * @static
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Number.POSITIVE_INFINITY = 0;
/**
  * function toFixed(fractionDigits)
  * @memberOf Number
  * @param {Number} fractionDigits
  * @returns {String}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Number.prototype.toFixed = function(fractionDigits){return "";};
/**
 * function toExponential(fractionDigits)
 * @memberOf Number
 * @param {Number} fractionDigits
 * @returns {String}
 * @since Standard ECMA-262 3rd. Edition
 * @since Level 2 Document Object Model Core Definition.
*/
Number.prototype.toExponential = function(fractionDigits){return "";};
/**
 * function toPrecision(precision)
 * @memberOf Number
 * @param {Number} fractionDigits
 * @returns {String}
 * @since Standard ECMA-262 3rd. Edition
 * @since Level 2 Document Object Model Core Definition.
*/
Number.prototype.toPrecision = function(fractionDigits){return "";};

/**
 * Object Boolean()
 * @constructor
 * @extends Object
 * @since Standard ECMA-262 3rd. Edition
 * @since Level 2 Document Object Model Core Definition.
*/
function Boolean(){};
Boolean.prototype = new Object();

/**
  * Object Array()
  * @constructor
  * @extends Object
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
function Array(){};
Array.prototype = new Object();
/**
  * Property length
  * @type    Number
  * @memberOf   Array
  * @see     Array
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Array.prototype.length = 1;
/**
  * function concat(args)
  * @param {Array} args
  * @returns {Array}
  * @memberOf   Array
  * @see     Array
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Array.prototype.concat = function(args){return [];};
/**
  * function join(seperator)
  * @param {String} seperator
  * @returns {Array}
  * @memberOf   Array
  * @see     Array
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Array.prototype.join = function(seperator){return [];};
/**
  * function pop()
  * @returns {Object}
  * @memberOf   Array
  * @see     Array
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Array.prototype.pop = function(){return new Object();};
/**
  * function push(args)
  * @param {Array} args
  * @memberOf   Array
  * @see     Array
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Array.prototype.push = function(args){};
/**
  * function reverse()
  * @returns {Array}
  * @memberOf   Array
  * @see     Array
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Array.prototype.reverse = function(){return [];};
/**
  * function shift()
  * @returns {Object}
  * @memberOf   Array
  * @see     Array
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Array.prototype.shift = function(){return new Object();};
/**
  * function slice(start, end)
  * @param {Number} start
  * @param {Number} end
  * @returns {Array}
  * @memberOf   Array
  * @see     Array
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Array.prototype.slice = function(start, end){return [];};
/**
  * function sort(funct)
  * @param {Function} funct
  * @returns {Array}
  * @memberOf   Array
  * @see     Array
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Array.prototype.sort = function(funct){return [];};
/**
  * function splice(start, deletecount, items)
  * @param {Number} start
  * @param {Number} deletecount
  * @param {Array} items
  * @returns {Array}
  * @memberOf   Array
  * @see     Array
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Array.prototype.splice = function(start, deletecount, items){return [];};
/**
  * function unshift(items)
  * @param {Array} start
  * @returns {Array}
  * @memberOf   Array
  * @see     Array
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Array.prototype.unshift = function(start){return [];};

/**
  * Object Function()
  * @constructor
  * @extends Object
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
function Function(){};
Function.prototype = new Object();
/**
 * function apply (thisObject, argArray)
 * @param {Object} thisObject
 * @param {Array} argArray
 * @returns {Object}
 * @since   Standard ECMA-262 3rd. Edition
 * @since   Level 2 Document Object Model Core Definition.
 */
Function.prototype.apply = function(thisArg, argArray){return new Object();};
/**
  * function call (thisObject, args)
  * @param {Object} thisObject
  * @param {Object} args
  * @returns {Object}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Function.prototype.call = function(thisObject, args){return new Object();};
/**
  * property length
  * @type    Number
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Function.prototype.length = 0;

/**
  * Object Date(s)
  * @constructor
  * @param {String} s
  * @extends Object
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
function Date(s){};
Date.prototype = new Object();
/**
 * function UTC(hour, min, sec, ms)
 * @memberOf Date
 * @param {Number} hour
 * @param {Number} min
 * @param {Number} sec
 * @param {Number} ms
 * @returns {Number}
 * @static
 * @since Standard ECMA-262 3rd. Edition
 * @since Level 2 Document Object Model Core Definition.
*/
Date.UTC = function(hour, min, sec, ms){return 0;};
/**
  * function parse(string)
  * @memberOf Date
  * @param {String} string
  * @returns {Number}
  * @static
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.parse = function(string){return 0;};
/**
  * function toDateString()
  * @memberOf Date
  * @returns {String}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.toDateString = function(){return "";};
/**
  * function toTimeString()
  * @memberOf Date
  * @returns {String}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.toTimeString = function(){return "";};
/**
  * function toLocaleString()
  * @memberOf Date
  * @returns {String}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.toLocaleString = function(){return "";};
/**
  * function toLocaleDateString()
  * @memberOf Date
  * @returns {String}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.toLocaleDateString = function(){return "";};
/**
  * function toLocaleTimeString()
  * @memberOf Date
  * @returns {String}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.toLocaleTimeString = function(){return "";};
/**
  * function valueOf()
  * @memberOf Date
  * @returns {Object}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.valueOf = function(){return new Object();};
/**
  * function getFullYear()
  * @memberOf Date
  * @returns {Number}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.getFullYear = function(){return 0;};
/**
  * function getTime()
  * @memberOf Date
  * @returns {Number}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.getTime = function(){return 0;};
/**
  * function getUTCFullYear()
  * @memberOf Date
  * @returns {Number}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.getUTCFullYear = function(){return 0;};
/**
  * function getMonth()
  * @memberOf Date
  * @returns {Number}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.getMonth = function(){return 0;};
/**
  * function getUTCMonth()
  * @memberOf Date
  * @returns {Number}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.getUTCMonth = function(){return 0;};
/**
  * function getDate()
  * @memberOf Date
  * @returns {Number}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.getDate = function(){return 0;};
/**
  * function getUTCDate()
  * @memberOf Date
  * @returns {Number}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.getUTCDate = function(){return 0;};
/**
  * function getDay()
  * @memberOf Date
  * @returns {Number}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.getDay = function(){return 0;};
/**
  * function getUTCDay()
  * @memberOf Date
  * @type Number
  * @returns {Number}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.

 */
Date.prototype.getUTCDay=function(){return 0;};
/**
  * function getHours()
  * @memberOf Date
  * @returns {Number}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.getHours = function(){return 0;};
/**
  * function getUTCHours()
  * @memberOf Date
  * @returns {Number}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.getUTCHours = function(){return 0;};
/**
  * function getMinutes()
  * @memberOf Date
  * @returns {Number}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.getMinutes = function(){return 0;};
/**
  * function getUTCMinutes()
  * @memberOf Date
  * @returns {Number}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.getUTCMinutes = function(){return 0;};
/**
  * function getSeconds()
  * @memberOf Date
  * @returns {Number}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.getSeconds = function(){return 0;};
/**
  * function getUTCSeconds()
  * @memberOf Date
  * @returns {Number}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.getUTCSeconds = function(){return 0;};
/**
  * function getMilliseconds()
  * @memberOf Date
  * @returns {Number}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.getMilliseconds = function(){return 0;};
/**
  * function getUTCMilliseconds()
  * @memberOf Date
  * @returns {Number}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.getUTCMilliseconds = function(){return 0;};
/**
  * function getTimezoneOffset()
  * @memberOf Date
  * @returns {Number}
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.getTimezoneOffset = function(){return 0;};
/**
  * function setTime(value)
  * @memberOf Date
  * @returns {Number}
  * @param {Number} value
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.setTime = function(value){return 0;};

/**
  * function setMilliseconds(value)
  * @memberOf Date
  * @returns {Number}
  * @param {Number} value
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.setMilliseconds = function(value){return 0;};
/**
  * function setUTCMilliseconds(ms)
  * @memberOf Date
  * @returns {Number}
  * @param {Number} ms
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.setUTCMilliseconds = function(ms){return 0;};
/**
  * function setSeconds(sec,ms)
  * @memberOf Date
  * @returns {Number}
  * @param {Number} sec
  * @param {Number} ms
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.setSeconds = function(sec,ms){return 0;};
/**
  * function setUTCSeconds(sec,ms)
  * @memberOf Date
  * @returns {Number}
  * @param {Number} sec
  * @param {Number} ms
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.setUTCSeconds=function(sec,ms){return 0;};
/**
  * function setMinutes(min,sec,ms)
  * @memberOf Date
  * @returns {Number}
  * @param {Number} min
  * @param {Number} sec
  * @param {Number} ms
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.setMinutes=function(min,sec,ms){return 0;};
/**
  * function setUTCMinute(min,sec,ms)
  * @memberOf Date
  * @returns {Number}
  * @param {Number} min
  * @param {Number} sec
  * @param {Number} ms
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.setUTCMinute = function(min,sec,ms){return 0;};
/**
  * function setHours(hour, min,sec,ms)
  * @memberOf Date
  * @returns {Number}
  * @param {Number} hour
  * @param {Number} min
  * @param {Number} sec
  * @param {Number} ms
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.setHours = function(hour,min,sec,ms){return 0;};
/**
  * function setUTCHours(hour, min,sec,ms)
  * @memberOf Date
  * @returns {Number}
  * @param {Number} hour
  * @param {Number} min
  * @param {Number} sec
  * @param {Number} ms
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.setUTCHours = function(hour,min,sec,ms){return 0;};

/**
  * function setDate(date)
  * @memberOf Date
  * @returns {Number}
  * @param {Number} date
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.setDate = function(date){return 0;};

/**
  * function setUTCDate(date)
  * @memberOf Date
  * @returns {Number}
  * @param {Number} date
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.setUTCDate = function(date){return 0;};

/**
  * function setMonth(month,date)
  * @memberOf Date
  * @returns {Number}

  * @param {Number} date
  * @param {Number} month
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.setMonth = function(month,date){return 1;};
/**
  * function setUTCMonth(month,date)
  * @memberOf Date
  * @returns {Number}
  * @param {Number} date
  * @param {Number} month
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.setUTCMonth = function(month,date){return 1;};
/**
  * function setFullYear(month,date)
  * @memberOf Date
  * @returns {Number}
  * @param {Number} date
  * @param {Number} month
  * @param {Number} year
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.setFullYear = function(year, month,date){return 0;};
/**
  * function setUTCFullYear(month,date)
  * @memberOf Date
  * @returns {Date}
  * @param {Number} date
  * @param {Number} month
  * @param {Number} year
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Date.prototype.setUTCFullYear = function(year, month,date){};
/**
 * function toUTCString()
 * @memberOf Date
 * @returns {String}
 * @since Standard ECMA-262 3rd. Edition
 * @since Level 2 Document Object Model Core Definition.
*/
Date.prototype.toUTCString = function(){return "";};

/**
  * Object Global
  * @super Object
  * @constructor
  * @memberOf Global
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
function Global(){};
Global.prototype=new Object();
/**
  * Property NaN
  * @memberOf Global
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Global.prototype.NaN=0;
/**
  * Property Infinity
  * @memberOf Global
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Global.prototype.Infinity=0;
/**
  * function eval(s)
  * @memberOf Global
  * @param {String} s
  * @type Object
  * @returns {Object}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Global.prototype.eval=function(s){return new Object();};

//@GINO: Bug 197987 (Temp Fix)
/**
  * Property debugger
  * @memberOf Global
  * @description Debugger keyword
 */
Global.prototype.debugger=null;

/**
 * Property undefined
 * @memberOf Global
 * @description undefined
*/
Global.prototype.undefined=null;

/**
  * function parseInt(s,radix)
  * @memberOf Global
  * @param {String} s
  * @param {Number} radix
  * @type Number
  * @returns {Number}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Global.prototype.parseInt=function(s,radix){return 0;};
/**
  * function parseFloat(s)
  * @memberOf Global
  * @param {String} s
  * @type Number
  * @returns {Number}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Global.prototype.parseFloat=function(s){return 0;};
/**
 * function escape(s)
 * @memberOf Global
 * @param {String} s
 * @type String
 * @returns {String}
 * @since   Standard ECMA-262 3rd. Edition
 * @since   Level 2 Document Object Model Core Definition.
*/
Global.prototype.escape=function(s){return "";};
/**
 * function unescape(s)
 * @memberOf Global
 * @param {String} s
 * @type String
 * @returns {String}
 * @since   Standard ECMA-262 3rd. Edition
 * @since   Level 2 Document Object Model Core Definition.
*/
Global.prototype.unescape=function(s){return "";};
/**
  * function isNaN(number)
  * @memberOf Global
  * @param {String} number
  * @type Boolean
  * @returns {Boolean}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Global.prototype.isNaN=function(number){return false;};
/**
  * function isFinite(number)
  * @memberOf Global
  * @param {String} number
  * @type Boolean
  * @returns {Boolean}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Global.prototype.isFinite=function(number){return false;};
/**
 * function decodeURI(encodedURI)
 * @memberOf Global
 * @param {String} encodedURI
 * @type String
 * @returns {String}
 * @since   Standard ECMA-262 3rd. Edition
 * @since   Level 2 Document Object Model Core Definition.
*/
Global.prototype.decodeURI=function(encodedURI){return "";};
/**
 * @memberOf Global
 * @param {String} uriComponent
 * @type String
 * @returns {String}
 * @since   Standard ECMA-262 3rd. Edition
 * @since   Level 2 Document Object Model Core Definition.
*/
Global.prototype.decodeURIComponent=function(uriComponent){return "";};
/**
 * function encodeURIComponent(uriComponent)
 * @memberOf Global
 * @param {String} uriComponent
 * @type String
 * @returns {String}
 * @since   Standard ECMA-262 3rd. Edition
 * @since   Level 2 Document Object Model Core Definition.
*/
Global.prototype.encodeURIComponent=function(uriComponent){return "";};

/**
 * function encodeURIComponent(URI)
 * @memberOf Global
 * @param {String} URI
 * @type String
 * @returns {String}
 * @since   Standard ECMA-262 3rd. Edition
 * @since   Level 2 Document Object Model Core Definition.
*/
Global.prototype.encodeURI=function(URI){return "";};

/**
  * Object Math(\s)
  * @super Object
  * @constructor
  * @memberOf Math
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.

 */
function Math(){};
Math.prototype=new Object();
/**
  * Property E
  * @memberOf Math
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.E=0;
/**
  * Property LN10
  * @memberOf Math
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.LN10=0;
/**
  * Property LN2
  * @memberOf Math
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.LN2=0;
/**
  * Property LOG2E
  * @memberOf Math
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.LOG2E=0;
/**
  * Property LOG10E
  * @memberOf Math
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.LOG10E=0;
/**
  * Property PI
  * @memberOf Math
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.PI=0;
/**
  * Property SQRT1_2
  * @memberOf Math
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.SQRT1_2=0;
/**
  * Property SQRT2
  * @memberOf Math
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.SQRT2=0;
/**
  * function abs(x)
  * @memberOf Math
  * @param {Number} x
  * @type Number
  * @returns {Number}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.abs=function(x){return 0;};
/**
  * function acos(x)
  * @memberOf Math
  * @param {Number} x
  * @type Number
  * @returns {Number}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.acos=function(x){return 0;};
/**
  * function asin(x)
  * @memberOf Math
  * @param {Number} x
  * @type Number
  * @returns {Number}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.asin=function(x){return 0;};
/**
  * function atan(x)
  * @memberOf Math
  * @param {Number} x
  * @type Number
  * @returns {Number}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.atan=function(x){return 0;};
/**
  * function atan2(x,y)
  * @memberOf Math
  * @param {Number} x
  * @param {Number} y
  * @type Number
  * @returns {Number}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.atan2=function(x,y){return 0;};
/**
  * function ceil(x)
  * @memberOf Math
  * @param {Number} x
  * @type Number
  * @returns {Number}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.ceil=function(x){return 0;};
/**
  * function cos(x)
  * @memberOf Math
  * @param {Number} x
  * @type Number
  * @returns {Number}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.cos=function(x){return 0;};
/**
  * function exp(x)
  * @memberOf Math
  * @param {Number} x
  * @type Number
  * @returns {Number}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.exp=function(x){return 0;};
/**
  * function floor(x)
  * @memberOf Math
  * @param {Number} x
  * @type Number
  * @returns {Number}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.floor=function(x){return 0;};
/**
  * function log(x)
  * @memberOf Math
  * @param {Number} x
  * @type Number
  * @returns {Number}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.log=function(x){return 0;};
/**
  * function max(arg)
  * @memberOf Math
  * @param {Number} args
  * @type Number
  * @returns {Number}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.max=function(args){return 0;};
/**
  * function min(arg)
  * @memberOf Math
  * @param {Number} args
  * @type Number
  * @returns {Number}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.min=function(args){return 0;};
/**
  * function pow(x,y)
  * @memberOf Math
  * @param {Number} x
  * @param {Number} y
  * @type Number
  * @returns {Number}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.pow=function(x,y){return 0;};
/**
  * function pow()
  * @memberOf Math
  * @type Number
  * @returns {Number}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.random=function(){return 0;};
/**
  * function round(x)
  * @memberOf Math
  * @param {Number} x
  * @type Number
  * @returns {Number}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.round=function(x){return 0;};
/**
  * function sin(x)
  * @memberOf Math
  * @param {Number} x
  * @type Number
  * @returns {Number}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.sin=function(x){return 0;};
/**
  * function sqrt(x)
  * @memberOf Math
  * @param {Number} x
  * @type Number
  * @returns {Number}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.sqrt=function(x){return 0;};
/**
  * function tan(x)
  * @memberOf Math
  * @param {Number} x
  * @type Number
  * @returns {Number}
  * @since   Standard ECMA-262 3rd. Edition
  * @since   Level 2 Document Object Model Core Definition.
 */
Math.tan=function(x){return 0;};
/**
  * Object RegExp()
  * @super Object
  * @constructor
  * @memberOf RegExp
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
function RegExp(){};
RegExp.prototype=new Object();
/**
  * function exec(string)
  * @param {String} string
  * @returns {Array}
  * @type Array
  * @memberOf RegExp
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
RegExp.prototype.exec=function(string){return [];};
/**
  * function test(string)
  * @param {String} string
  * @returns {Boolean}
  * @type Boolean
  * @memberOf RegExp
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
RegExp.prototype.test=function(string){return false;};
/**
  * property source
  * @type String
  * @memberOf RegExp
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
RegExp.prototype.source="";
/**
  * property global
  * @type Boolean
  * @memberOf RegExp
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
RegExp.prototype.global=false;

/**
  * property ignoreCase
  * @type Boolean
  * @memberOf RegExp
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
RegExp.prototype.ignoreCase=false;
/**
  * property multiline
  * @type Boolean
  * @memberOf RegExp
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
RegExp.prototype.multiline=false;
/**
  * property lastIndex
  * @type Number
  * @memberOf RegExp
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
RegExp.prototype.lastIndex=0;
/**
  * Object Error(message)
  * @super Object
  * @constructor
  * @param {String} message
  * @memberOf Error
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
function Error(message){};
Error.prototype=new Object();
/**
  * property name
  * @type String
  * @memberOf Error
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Error.prototype.name="";
/**
  * property message
  * @type String
  * @memberOf Error
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
Error.prototype.message="";
/**
  * Object EvalError()
  * @super Error
  * @constructor
  *
  * @memberOf EvalError
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
function EvalError(){};
EvalError.prototype=new Error("");
/**
  * Object RangeError()
  * @super Error
  * @constructor
  *
  * @memberOf RangeError
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
function RangeError(){};
RangeError.prototype=new Error("");
/**
  * Object ReferenceError()
  * @super Error
  * @constructor
  *
  * @memberOf ReferenceError
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
function ReferenceError(){};
ReferenceError.prototype=new Error("");
/**
  * Object SyntaxError()
  * @super Error
  * @constructor
  *
  * @memberOf SyntaxError
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
function SyntaxError(){};
SyntaxError.prototype=new Error("");
/**
  * Object TypeError()
  * @super Error
  * @constructor
  *
  * @memberOf TypeError
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
function TypeError(){};
TypeError.prototype=new Error("");
/**
  * Object URIError()
  * @super Error
  * @constructor
  *
  * @memberOf URIError
  * @since Standard ECMA-262 3rd. Edition
  * @since Level 2 Document Object Model Core Definition.
 */
function URIError(){};
URIError.prototype=new Error("");

//support for debugger keyword
var debugger = null;
时间: 2024-11-04 13:17:03

JS创建类以及类的方法(StringBuffeer类)的相关文章

Java 动态的创建注入代码,注入方法给类或者接口并通过反射调用

1.将要被注入的类: /* * 文 件 名: JNAUtil.java * 版 权: Sunny Technologies Co., Ltd. Copyright YYYY-YYYY, All rights reserved * 描 述: <描述> * 修 改 人: L.Hao * 修改时间: 2014-11-11 * 跟踪单号: <跟踪单号> * 修改单号: <修改单号> * 修改内容: <修改内容> */ package com.test; import

JS 创建自定义对象的方式方法

一.概述 还记得刚开始做项目的时候,看到别人封装的js工具类百思不得其解,看来看去看不懂,深挖一下,其实就是自己没有耐下心去看,但是遇到问题不解决,总会遇到的,今天还是遇到了,就去找了找帖子,重新思考与实践一下,豁然开朗~!在此记录一下迟来顿开的茅塞. 关于JS 对象,啊,对象么,不就是一个个实例么,是的,js 也可以创建类,创建对象,创建对象方法,我们今天就具体说一下. 二.创建与使用(开始) es 标准给我们提供了String.Math.Array等等这些js对象,当我们使用的时候只需要ne

JS创建和存储 cookie一些方法总结

在js中cookie的操作与存储及清除cookie都与时间有关,我们只要把cookie过期时间进行有效的设置我们就可以控制它的存储了,下面我来给大家总结一下js中cookie的一些使用技巧 创建和存储 cookie 在这个例子中我们要创建一个存储访问者名字的 cookie.当访问者首次访问网站时,他们会被要求填写姓名.名字会存储于 cookie 中.当访问者再次访问网站时,他们就会收到欢迎词. 首先,我们会创建一个可在 cookie 变量中存储访问者姓名的函数: function Setcook

24-oc类工厂方法和类对象基本概念

类工厂方法 用于快速创建对象的类方法, 我们称之为类工厂方法 类工厂方法应用场景 类工厂方法中主要用于给对象分配存储空间和初始化这块存储空间 类工厂方法使用规范 规范: 一定是类方法 + 方法名称以类的名称开头, 首字母小写 一定有返回值, 返回值是id/instancetype 在类工厂方法实现中,调用本类的构造方法,创建实例对象,并返回实例对象 自定义类工厂方法是苹果的一个规范, 一般情况下, 我们会给一个类提供自定义构造方法和自定义类工厂方法用于创建一个对象 类工厂方法在继承中的注意点 以

方法,类

方法 代表"完成某事的途径",其决定了一个对象能够接收到的信息. 例如:对象小明  小明在喝水 假设有对象X int  x = a.f() 像这样调用一个方法通常叫做:"向对象发送一条消息",其中消息是f 对象是a. 面向对象的设计通常简单的归纳为 "向对象发送消息" 类  因为在java中万物皆对象,所以 class 类 是对同一类对象的抽象  例如:狮子,老虎  都是动物  动物就是一个类 类中可以包含方法  即 类中有 数据成员(字段) 和

JS创建类和对象(好多方法哟!)

http://www.cnblogs.com/tiwlin/archive/2009/08/06/1540161.html 这是别人写的~~~我借来看看 JavaScript 创建类/对象的几种方式 在JS中,创建对象(Create Object)并不完全是我们时常说的创建类对象,JS中的对象强调的是一种复合类型,JS中创建对象及对对象的访问是极其灵活的. JS对象是一种复合类型,它允许你通过变量名存储和访问,换一种思路,对象是一个无序的属性集合,集合中的每一项都由名称和值组成(听起来是不是很像

Javascript使用function创建类的两种方法

1.使用function类 //myFunction.js var CMyFunc=function() { //类的公共方法,供外部调用 this.Func1=function() { var i=0; return i; } this.Func2=function() { _privateFunc(); } //类中的私有方法,供公共方法调用 function _privateFunc() { return 0; ] } CMyFunc myFunc=new CMyFunc(); 使用:其它

JS创建类和对象

JavaScript 创建类/对象的几种方式 非常好的一篇讲类和对象的文章,逐一测试,加深记忆:http://www.cnblogs.com/tiwlin/archive/2009/08/06/1540161.html 在JS中,创建对象(Create Object)并不完全是我们时常说的创建类对象,JS中的对象强调的是一种复合类型,JS中创建对象及对对象的访问是极其灵活的. JS对象是一种复合类型,它允许你通过变量名存储和访问,换一种思路,对象是一个无序的属性集合,集合中的每一项都由名称和值组

js创建类(封装)

js如何创建类(封装) 学过其他面向对象语言的JavaScripter,可能都应用过类,如:class{},等定义的一系列方法, 但是初学者看是学习js的时候,经常会看到这样一句话,那就是JavaScript是面向对象语言,可是自己无论怎么学习,都不太清楚面向对象编程,我也是如此,开始一直纠结js面向对象编程,这几天算是有所了解了,谈谈我对js类的理解... 所谓类,会有以下功能: 构造器 静态属性,静态方法 共有属性,共有方法 私有属性,私有方法 本文就说说如何用js实现对类的封装,实现上述功