The reason JCB are looking at Hydrogen is because in many places where their equipment is used there is often no ready electrical supply, and in many cases the equipment is in double shift use, so there would be insufficient time to recharge some of teh bigger machines between shifts.
There is also the problem that on most of their larger machines, there is insufficient space to carry enough battery storage to run the machine. It's in this set of circumstances where Hydrogen begins to make a case for itself. JCB looked at using hydrogen in a fuel cell and then to use electricity to actually drive the machines. Technically that would be possible now but, the problem is apparently fuel cells are presently too fragile to withstand the vibrations and stress earth moving machinery experience, so reliability might be compromised.
JCB's solution is to redesign their present diesel engines to run on pure hydrogen, which they have managed to do, and are presently evaluating the durability and reliability of the new parts, and apparently it is looking promising.
But there are still flies in the ointment. Production of Hydrogen for use as a mass fuel is still some way off. so getting supplies economically to sites is still a major concern. Even when or if it becomes more readily available it will still be a far more expensive option than today's Dino juice, so civil engineering jobs are going to become more expensive.
JCB's smaller models are a different proposition. Often only working normal hours in well serviced areas, they can be converted to battery power and recharged overnight.
JCB is a highly specialised sector and what might work for them is not necessarily appropriate for domestic car strategies. Until someone can find a truly cost effective means of producing hydrogen, it will not become a realistic alternative for most domestic vehicles.