And Moses was there with The LORD forty days and forty nights; he did neither eat bread, nor drink water. And he wrote upon the tables the words of the covenant, the ten commandments. Exodus 34:28
“And the angel of The LORD came again the second time, and touched him, and said, Arise and eat; because the journey is too great for thee. ate and drank. Strengthened by that food, he traveled forty days and forty nights until he reached Horeb, the mountain of God.” 1 Kings 19:7-8
https://www.womanofnoblecharacter.com/fasting-in-the-bible/
Fasting traditionally presaged a great spiritual struggle. Elijah and Moses in the Old Testament fasted 40 days and nights, and thus Jesus doing the same invites comparison to these events.