The Prophet salla Allahu alaihi wa sallam told us that there are no days better at the side of Allah than these ten days for a servant to offer good deeds. The Prophet salla Allahu alaihi wa sallam is encouraging us to do good deeds without any specification. By far, fasting is one of the best deeds.
Though we don’t have anything authentic stating that the Prophet salla Allahu alaihi wa sallam fasted these days, his instruction to offer good deeds is more than enough.