Try and understand the situation. This DOES NOT mean press the person for questions but at least try and figure out what is causing this person to panic. Even if you don't get it fully, tell this person that you understand how they must be feeing. A lot of the time, I get really upset for I feel as though my emotions are stupid and as though I am just blowing everything out of proportion.
Do not joke around. One time, I had a panic attack on my friend's bed while another friend was over and the two of them just kind of began joking around about me having an attack and almost making fun of the things I had told them about what panic is. I did not tell this story so I could rant about how thoughtless they were acting (they are lovely people just a little clueless when it comes to this) but to say that I felt really terrible that my friends didn't realize how serious this was.
If this person is in a crowded room, tell people to back away and take the person out of the situation. No one likes being crowded around especially in a situation like this. If there is not another room this person can go into, inform people what is going on and clear out the space around the person having a panic attack.
NEVER tell someone having a panic or anxiety attack to "just calm down". Breaking this sentence down, every word counts. The use of the word just is extremely impactful. "JUST calm down." as though calming down is some extremely easy activity to do when you're brain is rushing and you're in such a state of panic. You should help this person calm down but merely telling them to will not just do nothing but hurt them even more.
Ask the person if there is anything you can do to help them. Sometimes, the thing this person needs the most is just to be left alone. If this person just wants their space, respect that and leave them alone. In some cases, the most helpful thing you can do is leave.
I realize that someone breaking down like this can be rather frightening but saying that out loud to your friend who is going through this attack can make their experience even scarier. What you have to realize is that this person is going through a lot all at once and really shouldn't be focusing on what their friends and the people around them are saying. If you are scared, though you shouldn't be, get someone that can actually help instead of making it worse.
Tell this person you're here for them. A lot of times, people really don't feel as though others care for them. Telling someone this can really make a person feel better.
Don't ever tell a person going through an anxiety or panic attack that it is nothing or what they're feeling is stupid. Though anxiety attacks only last for a few minutes, so much goes through you when you are having one. Though it may be hard to put yourself in the shoes of this said person, telling them that their feelings are invalid is not the way to go.
These are just a few things that are really important to learn about what to do when someone around you is having one of these attacks. To learn more about them, I suggest going to Psych Central.com I also have an amazing song the lovely, Peej Liguori covered that really gives you a good understanding of what an anxiety attack is.