Mobile and desktop specific jquery

Javascript based on screen  size:

if ( $(window).width() > 736) {     
 alert("desktop");
}
else {
   alert("small screen");
}
You can specify the width of mobile, tab etc. both Portrait and landscape