Word meaning doing something just cause you can or have the abilitity to do it

I'm looking for a word that describes the act of doing something without a real logical reason but just because they can. A example of what I'm talking about would be like this:

The boy hacked the Pentagon just because he could. He didn't steal anything and he didn't want the attention; he just wanted to proclaim his own self-dignity.

What would you call someone like that or the act of doing something like that?


Solution 1:

While not a single word, the idiomatic for the hell of it seems to convey your intended meaning quite nicely:

Also, for the heck of it; just for the hell of it. For no particular reason; on a whim. For example, We drove by the old place just for the hell of it. In the first variant, heck is a euphemism for hell. [First half of 1900s]

if you do something for the hell of it, you do it only because you want to, or because you think it is funny I decided to dye my hair bright green, just for the hell of it.

Solution 2:

Perhaps gratuitously

Definition: being done in a manner not demanded by the circumstances, without apparent reason, cause, or justification.

Example: Seven soldiers on patrol in south area killed an innocent teenager in a gratuitously violent attack using rifle butts, helmets, fists and feet.