Genesis 45:5, 7, 8, Elohim sent me. Joseph was sold into slavery at age 17, was freed from prison and made ruler of Egypt at age 30. After that, seven years of plenty followed, and then two years of famine had passed by the time he was reunited with is brothers. Only after 22 years in Egypt did Joseph finally figure out Elohim’s grand and wonderful plan for his life, and how it involved the saving of his family.
Had Joseph lost faith along the way, become embittered over his multiple misfortunes, and turned away from Elohim, the nation of Israel may have never been preserved.
Keeping one’s eyes on Elohim, and refusing to lose faith during the dark times of one’s life can yield some amazingly triumphant outcomes, as we learn from the life of Joseph.