# Javascript 常用工具封装

## 类型判断

```Javascript
function type (o) {
    return Object.prototype.toString.call(o).toString().slice(8, -1);
}
function sayHi () {
    console.log(`Everybody sayHi`);
}

console.log(type(1))    // Number
console.log(type('@航程小刘(http://github.com/FantasticLBP)'))  // String
console.log(type(null)) // Null
console.log(type(false))    // Boolean
console.log(type({}))   // Object
console.log(type([1,2,3]))  // Array
console.log(type(sayHi))    // Function
```