I've punched/slapped/pounded dozens of cars, probably approaching 100, over 20+ years of running. Which also means I've had thousands of of runs where I don't punch cars.
Always remember two things: (1) Pedestrians have the right of way. (2) If a person almost hits you with a car due to their negligence, they are either an @ssh0le, entitled, obtuse, dangerous, or some combination of those.
With that said: you're playing with fire, and the chance of having any net-positive impact is very slim. So it's a personal choice. If you felt good hitting the car that almost ran you over - hit it, and hit it hard enough to scare the driver. If you felt guilty after, I wouldn't lose sleep but I'd also not do it again. If you felt scared b/c the ensuing conflict scared you, you need to do a deeper cost/benefit analysis.
Lol at the quack who's argument is that it's a crime to slam your hand on on someone's car. "cRiMiNaL bEhAvIoR!!!!" If you can get arrested for slamming your hand on a car that almost ran you over, you can get arrested for almost running a human being over with your car. What a softy.
I live in densely populated area so there's are lots of driveways, lots of intersections, and lots of cars. But I actually enjoy when a person whose car I've struck rolls down their window and tells me their calling the police on me. I often stop and tell them to safely pull over so that I can wait while the authorities arrive. It's not uncommon for another car or other pedestrians to pay attention after a car almost strikes someone and there is a loud thump, a screech of a tire, a horn honk, or even some yelling. A few times I've yelled out in a mock terrified voice: "Oh Officer! I failed to stop at a cross walk and I almost ran this person over! And then.... then..... then they HIT my CAR with their HAND!!" And I put the back of my hand to my forehead and I gasp. Do I demonstrate unhealthy and unstable behavior? Yes indeed. Do the passers by that are watching enjoy the show, and do I often get people coming up and offering me assistance and support? Yes indeed.
Pedestrians have the right of way and most drivers don't GAF and too many are distracted (aNoThEr CrImInAl bEhAvIoR!). If one almost hits you, I wouldn't hesitate to hit it.
https://www.google.com/search?q=2025+pedestrian+automobile+accidents&oq=2025+pedestrian+automobile+accidents&gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIGCAEQLhhA0gEJMTg1MjNqMGoxqAIIsAIB&sourceid=chrome&ie=UTF-8