This question originally appeared on Quora. Answer by Fabian van den Berg.

Humor is another one of those things/aspects that we really don’t stop and think about how it even works. We take so much for granted don’t we? We’re terrible to our brains. Anyway, humor, let’s see what we know.

Let’s establish our terms first. Humor in general, is it even a thing? Is it a human thing? Is it different for everyone? what the heck is humor anyway? We, humans, are definitely not the only species to express pleasure with laughter. We know that other animals laugh too (which is the only objective measure we have of this, not like we can ask them if it was funny).

Aside from that famous hyena laugh (which isn’t a sign of happiness) we’ve made plenty of animals giggle. Not just close ape cousins, but also dogs and rats. Oh how I wish I was the scientist in charge of rat-tickling, that’s a resume to be proud of. Anyway, what this tells us is that laughter is likely an early evolutionary mechanism. In dogs and rats it conveys play-behavior, so we assume there is some social information being conveyed.

From an evolutionary standpoint you might think in the line of conveying that something isn’t threatening or dangerous, but it could also have to do with social relationships (since we laugh more with others are around). Humans are unique in the way we use humor. Dogs, apes, or rats can’t tell jokes. Humans have more complex behavior that enables our humor to be a bit more…advanced. Our social behavior is very complicated, so it’s not strange that our humor evolved with it. Laughing isn’t a human specific thing, but jokes/humor is. Humor requires more complex functions that other animals don’t seem to posses (explains why my dogs were never amused by my teasing).

Humor/laughing is actually a thing, so what do we see in the brain? When scanning people we notice that it has to do with expectations and the violation of scripts. We find things funny that don’t fit with what we think should happen. Our brains are pretty good at predicting what might happen. We like routines, anything that deviates will pop out. The detection of whether something is funny or not seems to happen in the left Inferior Frontal and Posterior Temporal lobe. Your amygdala then releases some dopamine and spindle neurons transmit the happy feeling to other areas.

Different types of jokes result in different types of activation of course (puns for instance make the language centers go wild). Regardless of the joke-type the brain responds to humor. Humor is when we expect one thing and then something else happens, when our scripts are broken in a non-threatening way. This also corresponds with a lot of jokes and physical humor. You expect one thing and then the twist turns it around completely.

The brain doesn’t necessarily ‘decide’ if something is funny. It’s more a question of ‘did it see it coming?’ If expectations are violated it can elicit joy and happiness. The entire process, the how’s and why’s aren’t known yet, but I believe the general consensus is that it relays social information to others. It signals that nothing bad is going on, everything is fine, so join in and don’t worry.

More from Quora: