In a formaldehyde compound we will have a central Carbon being linked to 2 Hydrogens and one Oxygen, even though the bonding with the two hydrogens is a covalent bond, which means they are sharing electrons in the valence shell, the polarity between oxygen and carbon in the double bond makes the compound to be a Polar Covalent Compound, having a polar covalent bonding
When defining a type of bonding between elements, we can use the electronegativity rules, which states, if:
The difference in electronegativity between the two elements is less than 0.5, the compound will be covalent, in Carbon and Hydrogen for example the difference is 2.5 C - 2.1 H = 0.4, this is why in compounds with only C and H we will always have a covalent bonding, or nonpolar covalent bonding, because neither elements are pulling the electrons in the valence shell from each other, they are sharing it, all 4 electrons from C and 1 electron from H
If the difference is between 0.5 and 1.6, the bonding will be considered to be a polar covalent bonding, it is not an ionic bonding but it will cause some pulling of the electrons towards one element, and in Carbon and Oxygen case this is exactly what happens
3.5 O - 2.5 C = 1.0, which is why formaldehyde will be a polar covalent compound, because the 6 electrons from the valence shell of the Oxygen will pull with a considerable force the 2 electrons shared from the Carbon atom
If the difference is greater than 1.6 we will have an ionic bonding, which is the case of NaCl for example