use instanceof instead of using comparing obj.constructor.name to check array