JavaScript 判断当前设备是否是移动端还是PC?

if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){
alert('移动端')
}else {
  alert('PC端')
}