Barium hydroxide is an ionic compound with the chemical formula Ba(OH)2. It forms an ionic bond because of the transfer of two electrons from the barium to two hydroxides.
According to Elmhurst College, an ionic bond occurs as the result of a transfer of electrons from a metal onto a non-metal. An ionic bond reflects the interaction between positively charged and negatively charged ions. Metals, such as barium, give up electrons easily due to their ionization potential; less energy is required to remove electrons from metals because they have few electrons in their outer energy level.
According to Socratic, molecular compounds are covalently bonded; electrons are shared between multiple elements in the compound. Molecular compounds are typically made up of multiple non-metals.