Use instanceof instead of typeof

Not only is **instanceof** simpler, it's faster too.