“Yahweh said.” Joshua 8 gives the longest description of any conquest battle. Yet, the chapter is really about how Israel is restored to the right relation with Yahweh after the covenant was breached by Achan. Yahweh gives instructions on how to deal with Ai, and Joshua and Israel follow those instructions. The instructions also relate to faithfully following the Torah of Moses, especially Deuteronomy. The last verses of the chapter, Joshua 8:30-35, may seem like an interruption in the conquest account but they fit the theme of the reestablishment and confirmation of the covenant relationship between Israel and Yahweh. The God of Abraham, Isaac, Jacob, and Moses is the God of the people of Israel, and God will fulfill His promises. The wise believer listens to God and believes and obeys Him.
“Do not be afraid or be dismayed.” This must have been huge comfort to Joshua and it can be huge comfort to believers today. Joshua had just lost 36 men in his battle with Ai, and had reason to be concerned about another battle. But God is a God of forgiveness and restoration, and when Israel repented and took measures to restore their covenant relation with Yahweh, He assured them that He would be with them.
“the king of Ai and...and...and.” This is the figure of speech polysyndeton. The repetition of “and” emphasized each part. God made it clear that Joshua would conquer the king and his kingdom.