Here's why that is the case.
As you know, oxygen is much more electronegative than hydrogen, so any time these two elements will form a single covalent bond, which will polar in nature, oxygen will "take" both bonding electrons used to make the bond.
This will leave hydrogen with a
Similarly, this will leave oxygen with a
Now, take a look at the Lewis structure for hydrogen peroxide,
Notice that each oxygen atom is bonded to
The two oxygen atoms are also bonded to each other, but since both atoms have the same electronegativity value, this bond will not affect their oxidation number.
Therefore, you can say that oxygen has a
#stackrel(color(blue)(+1))("H") _ 2 stackrel(color(blue)(-1))("O")_ 2#