Further explanation 
1. ionic bonding 
Bonding that occurs due to electron handover. Can occur in metal and non-metal atoms. To get stability, atoms release or bind electrons to get stable electron regulation from noble gases 
2. covalent bonding 
Bonding that occurs due to shared use of electron pairs 
The two bound atoms contribute their electrons to produce bonds 
Generally occurs in non-metallic elements 
H₂Y compound
1. Y from group 16(valence electron=6)
2.Each Y atoms need 2 electrons by forming 2 bonds with atoms of H
3. There are 2 unshared electron pairs and 2 bonding electron pairs
4. The bonds in the product are covalent