More on Joshua as a retrospective.
Early on in the book, Joshua sends two spies into Jericho where they meet Rahab the prostitute (or, the whore-woman, as Robert Alter so colourfully describes her in his translation).
The sending of two witnesses into a city ripe for destruction should remind us of the two angels visiting Sodom to warn Lot’s household of the wrath to come. Like Lot, Rahab shows hospitality to the spies and is saved from the judgment. Her salvation also recalls the Passover: just as the households of Israel were spared from judgment by smearing blood on their doorposts, so also Rahab’s household is spared from judgment by tying a blood-coloured cord in her window.
Rahab also might remind us somewhat of Tamar, who presented as a whore to Judah in order to raise up seed by him. Recall also that Tamar demanded a pledge for payment from Judah before he went into her. She later produced these items of pledge and was spared from fiery judgment. Similarly, Rahab demands a vow from the spies that have come into her home that she will be spared from the fiery judgment soon to come. And like Tamar, Rahab marries into the line of Judah (per Chronicles and Matthew) and she raises up royal seed.
Lastly, Rahab also reveals an interesting little detail that throws the events of Numbers into a new light. We recall Israel at the border of the promised land, fearing the giants in the land and disbelieving that God would fulfill his promise to give them the land. Meanwhile, inside the land, it turns out that the inhabitants of the land heard that the people of the Exodus were coming with their God, and they were filled with fear:
And she said to the men, "I know that the Lord has given you the land, and that your terror has fallen upon us and that all the dwellers of the land quail before you […] And we heard, and our heart failed, and no spirit arose in any man before you, for the Lord your God, He is God in the heavens above and on the earth below… (Josh. 2:9, 11, The Hebrew Bible)
As Robert Alter notes, Rahab's revelation that "all the dwellers in Canaan quailed" echoes the Song of the Red Sea (Ex. 15:15-16).
This rubs some salt in the wounds of the wilderness generation. Even the Canaanites believed that God would keep his promises to Abraham’s offspring…