How is an ambush done?
Malbim: There are different kinds of ambush, like we find regarding Avimelech (Shoftim 5). (a) They are in front of the city, ready to pounce suddenly on people who leave the gate of the city. (b) Ambush in the field, like people of Shechem lied in ambush in the mountain tops and robbed everyone who passed by. They must distance greatly from the city, lest the victims inform the city, and people will beware from them. (c) Both ambushes are done together, like Avimelech divided his people among three heads. Two of them ambushed people who go out to the field, and one was at the gate of the city, so people could not return to the city. Here, Yehoshua said to ambush the city itself, unlike all three ways.