The valency of Hydrogen is 1. It can either gain one electron to complete the nearest noble gas configuration or loose the electron.
hydrogen resembles with both alkali and halogens. If it gains one electron it will resemble with halogens. And when it gives away its only electron, it aquires the property of the alkali metals.
Hope this helps.. :)