Having a valid visa allows you to go to a U.S. port of entry and request entry to the U.S.. If you leave the U.S. for travel and return, as long as your H-1B visa is still valid, you may be able to be admitted on H-1B status. You may wish to bring evidence of your employment or your visa validity with you to present at the border.