The picture above is of an A-10 that was shot up over Baghdad in 2003. You can see several dozen bullet holes, possibly from a 23mm cannon (ZSU-23-4 or ZU-23-2). Now imagine an F-35 with that kind of damage, it would be blown out of they sky. The sky over a battlefield is by it's very nature filled with ground fire. Most of it is wild, and simply shots that missed their targets. However, every so often you will come across some sort of air defense system, be it an armored vehicle like the ZSU-23, or any sort of gun-based air defense system. And the F-35, like most other 4th and 5th generation fighters cannot take a great deal of punishment and stay in the air. That is a trade-off that occurs the more advanced the fighter.
Aircraft have to be built specifically for the close air support mission to perform that mission consistently. The F-15 and F-16 are air-superiority fighters, but they often perform the CAS mission. However, if they were fighting against an enemy with an a real IADS they would have to "shoot and scoot" before they are targeted by local air defense systems. The A-10 on the other hand can loiter over the target longer simply because it can absorb a great deal of punishment (the A-10 can take a 23mm hit almost anywhere and stay in the air, someplaces it can absorb a 57mm hit and stay up.) and bring it's pilot home.
If you want an aircraft to perform the CAS mission and be able to loiter above the battlefield, it has to be built for the mission. It has to be armored like a tank, have backup mechanical flight controls, the cockpit has to have extra armor, the canopy has to be made of bulletproof glass, it has to be able to take scores of high-caliber hits and stay in the air. The F-35, while an excellent air superiority fighter, will make a poor CAS aircraft simply because it can't take the punishment that comes with the mission.