How to determine iPad OS with JavaScript

I tried to judge iPad OS with JavaScript, but it is recognized as mac OS instead of iPad OS.

Please tell me the script that can be recognized as iOS for iOS12 and iPad OS for iPad OS.