Num 13 and 14 discuss the spies sent by Moses to asses the land, among them Joshua and Caleb. Josh 14:7 says that Caleb was 40 when he was sent as a spy. How old was Joshua at the time of the spies (giants/grasshoppers) venture?
It is not known how old Joshua was at any stage of the narrative, nor can his age at any point even be approximated with any real accuracy. We can, however, point up a couple things to at least rank it likely he was younger than Caleb. At JA 14.10-11 we find Caleb essentially boasting to Joshua that despite being of a now advanced age he's still been able to carry his weight and prove his mettle on the battlefield over the past six years. One imagines he wouldn't be boasting of such a thing to any fellow warrior equal to his age, much less older, from which it seems almost apparent Joshua was younger than Caleb, and perhaps younger to some significant extent. Secondly, Moses in their very first year, at ES 33.11, calls Joshua a young man, this being when [by NS 10.11 and JA 14.7] Caleb was age 39. It seems unlikely Joshua would have been the appropriate object of Moses' description if he'd been really even much near Caleb's age. He was probably ten or more years younger than Caleb, and may have ruled over Israel post-conquest as many as forty years. The author of the Seder Olam ventures [for the latter] a guess of 28 years, which would make Joshua an unlikely "only three years younger" than Caleb, but he does so in a way that strains against the otherwise straightforward meaning of the Judges account. Mind you, of course, this is not to attest to the actual historicity of the story, neither in part nor in whole, but is only to piece together missing details based on extant ones.