function myType(v){ console.log(Object.prototype.toString.call(v)) return Object.prototype.toString.call(v).replace(/^.{8}(.+)]$/,(m,$1)=> $1.toLowerCase()); } var res = myType(1) console.log(res)