What does an army need first for a successful invasion? A bridgehead. Crossing the Jordan from Gilead gave the Israelite tribes an excellent bridgehead—safe land behind them, good routes into easily defensible mountains, lots of fords where small armies can attack and retreat, and fertile land on which to settle and produce resources. Jericho was the only problem, and again, Joshua uses spies to find out how big a problem.
Read Joshua 2:1. Rahab might have been a harlot, but the same word means hostess and an inn would be a perfect place to gather intelligence.
The spies learn that morale is low. They may also have found that the walls of Jericho were in poor repair, but that’s not recorded—it’s inferred from history. Their report, and God’s guidance, lead Joshua to send the people marching round the enemy city, and, famously, the walls fall down, whether from disrepair, another earthquake, resonance with the Israelite shout, or even because the enemy was lulled into hiding away while the Israelites broke them… Battles of the Bible prefers the last approach, citing a successful strategy of lulling the enemy by getting them used to your maneuvers before you attack.