I want to have 2 different outputs for mobile and desktop how I must handle it with javascript? for example
first i check the device width if width <= 700 px is mobile = true and show mobile output(html,js,css) else mobile = false is mean device is a desktop and show desktop output (other html,js,css)
how I can do this?
If you must handle it through JavaScript, you can use the window.screen.width and window.screen.height properties to check the devices height and width. But as a Comment already suggested, you might want to look into media-queries in CSS they are pretty powerful.
Possible usage
if(window.screen.width <= 700) {
// do mobile logic
} else {
// do desktop logic
}
You can use media query to handle what will do by its screen size.
Here is to handle it with JS,
Reference:
And here is when you want to handle with CSS, you can follow this link