How to distinguish the userAgent between iPadOS and Macos.

In the iPadOS the window.navigator.userAgent is same as the value in the MacOS. How to distinguish them.
And l find maybe can use the window.navigator.maxTouchPoints, but seems this is not the best way to handle this.
How to distinguish the userAgent between iPadOS and Macos.
 
 
Q