Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript type checking

var trueTypeOf = function (obj) {
	return Object.prototype.toString.call(obj).slice(8, -1).toLowerCase();
};

// Returns "array"
trueTypeOf([]);

// Returns "date"
trueTypeOf(new Date());
Source by gomakethings.com #
 
PREVIOUS NEXT
Tagged: #javascript #type #checking
ADD COMMENT
Topic
Name
4+7 =