Detects the current device type (mobile or desktop) based on the browser's user agent.
mobile
desktop
"mobile" if the device is identified as a mobile or tablet, otherwise "desktop".
"mobile"
"desktop"
const type = getDeviceType();console.log(type); // "mobile" or "desktop" Copy
const type = getDeviceType();console.log(type); // "mobile" or "desktop"
Detects the current device type (
mobileordesktop) based on the browser's user agent.