We have two burros, one miniature and one rescue from Arizona. As noted above, an apple or handful of carrots is the best defense. Our little one is the star of the farm. He's curious and will look for forehead scratches. The rescue, Chaco, is more wary of strangers, especially men, (wonder why?).
We also have two miniature cows, and the burros will watch out for them. If a storm is coming, the burros will herd the cows to safety. They also make sure coyotes stay out of the pasture.
Burros are much smarter than horses, and what most people see as stubbornness is actually caution.