You can get the size of the window or document with
// Size of browser viewport.
// Size of HTML document (same as pageHeight/pageWidth in screenshot).
For screen size you can use the screen object:
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.