Answer is: electronegativity.
Electronegativity (χ) is a property that describes the tendency of an atom to attract a shared pair of electrons. Atoms with higher electronegativity attracts more electrons towards it, electrons are closer to that atom. For example fluorine has electronegativity approximately χ = 4 and oxygen χ = 3,5, fluorine attracts electron and he has negative charge and oxygen has positive charge.