You can achieve this by defining said variable in global scope; if that var screenWidth = ... is defined inside some other function context you will not have access to it from other functions.
Using globals is a bad idea; however, in many cases you need some variable value that you need access to from other places. In this case, you could construct a well defined "Globals" container, like i.e:
'use strict'; // strict mode :: prevents nasty bugs
this.Main = this; // super-global :: refers `window` -or- `global`
Main.Globals = {screenWidth:null};
// your dynamic screen resizing code here sets the `Globals.screenWidth`
// now you have access to this anywhere
You can also write some code to have this Globals object be only writable by certain functions, but this technique is probably out of the scope of this question; however it could be a good idea considering that this code is part of a large project with many collaborators in your team.
widthvalue. Do you call it every time a resize event happens? How do you synchronize the two methods? IfschowContentis defined outside of the scope where thevar screenWithvariable (which is not nessecarily a "global" variable; you could have defined it in another function body or in a requirejs module) is defined then, thescreenWithwill be unknown to theshowContentMethod.