1. 程式人生 > >javascript 判斷是否為字串物件

javascript 判斷是否為字串物件

	// Save a reference to some core methods
	toString = Object.prototype.toString,
	// See test/unit/core.js for details concerning isFunction.
	// Since version 1.3, DOM methods and functions like alert
	// aren't supported. They return false on IE (#2968).
	isFunction: function( obj ) {
		return toString.call(obj) === "[object Function]";
	},


	isArray: function( obj ) {
		return toString.call(obj) === "[object Array]";
	},