How to find screen resolution using javascript?

We can find out the screen resolution by using the property screen.width and screen.height.  The following javascript code will alert the screen resolution.

Example:

<script type="text/javascript">
        var width = screen.width;
        var height = screen.height;
       alert(width + ' x' + height);
    </script>