One of its primary purposes is air-to-air. Don't take my word for it: https://www.f35.com/about/capabilities
The A version of the F-35 has three seconds worth of gun ammo. It would only be two seconds, but there's some lag between the trigger pull and the gun being fully spun up.
This is why Dick Cheney exists!
This is why he went from sec defense, setting policy for contractors, to heading haliburton, to VP underling of GHW and starting a new war - the longest, most expensive war the US has ever known.
Now lets bolt on a new defense project to funnel even more money...
Why do you think Tom Ridge left DHS to join the board of Lockheed??? MIC revolving door.
Of course, the F-22 would eat them up as well, but it's a stealth air superiority fighter while the F-35 is a stealth multi-purpose strike fighter.
But at least it's also a terrible ground attack plane and bomber too.
If you're asking what its role was in that specific strike: Israel doesn't have any other stealth capabilities. So its role would be to fly over troubled territory rather freely, given the capabilities in the region. The F-15s and F-16s they have can't do that.