In addition, this is an F35A vs Gripen E, so the Gripen has a better STOL capability, likely better radar (rotating GaN), more mature avionics link, supercruise, similar RCS (apart from frontal, it's likely to be smaller, red flag exercises hinted that they were not really detectable) and faster software updates.
WRT stealth, if you want to be stealthy you can't use active radar, only passive. As such having IRST capability in addition to a good datalink is extremely useful to detect other aircraft. The F22 has no IR capability so is at a disadvantage in BVR from that, similar for the F35 which (I think) only has a downward targeting IR.
From a reliability perspective, the Gripen is a long way ahead, the duty availability F35s is probably 70% at best by now (2019 figure was 50% https://www.ainonline.com/aviation-news/defense/2019-06-16/q...) mainly due to parts shortage. The F35 still can't fly in stormy weather due to lightning strikes etc.
I've no doubt the F35 can be a capable aircraft, just not compared to it's competitors. The decision, as usual, is more a political one.