I want another function (or several functions) to use the result of the first move function, that is, to show what the variable w is equal to at the moment.
Here is an example:
function move() { var w = document.documentElement.clientWidth } $(window).resize(move); $('.button').click(function() { alert(w); }) <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> <div class="button">Узнать ширину</div> in the example, the function does not work on click, as the variable w not found