check the type of an object in js