My dad taught me that lesson when I was still on my learner’s permit. Anytime you have to slam on the brakes, keep an eye on the rear view mirror. Even if you can’t avoid getting rear ended, you can release the brake and allow the energy to transfer through the car.