var aArray = [1,2,3];
var obj = {a:123};
var d = new Date();
var re = /\d+/;
function type(o){
var obj = {};
var str = obj.toString.call(o);
return str.slice(8, -1).toLowerCase();
}
console.log(aArray.toString());
console.log(obj.toString());
console.log(d.toString());
console.log(re.toString());
console.log(type(aArray));
console.log(type(obj));
console.log(type(d));
console.log(type(re));