how to pass data and develop applications
<p>Trying to sort out some general things considering usage of js and jquery particularly.
Was reading ~million of answers through stackoverflow without clean understanding how to pass data to another function and how do we build applications.</p>

<p>I got pretty usual schema:</p>

<pre><code>$(document).ready(function){

   $('.classname').click(function() { 
      var varone = $(this).attr('name');
   });

   $('.class2name').click(function(){
      var vartwo = $(this).height();
   });

});
</code></pre>

<p>Then i go out from (document).ready and want to do some handling like</p>

<pre><code>    function dosmth() {
       var freaksum = varone + vartwo;
    }
</code></pre>

<p>How do i do that? I want to pass objects, not make globals.</p>

<p>What are the practices to handle such things developing large applications?
I want to have some function which is making lot of operations with lot of variables from other functions. How do i get all these objects in my operational function? 
What if i have to use these variables not inside a single function, but in several different functions, like</p>

<pre><code>function dosmth() {
   var freaksum = varone + vartwo;
}

function dosmthelse() {
   var freakmult = varone * vartwo;
}
</code></pre>

<p>etc etc</p>

<p>Sorry for a long one, thank you.</p>
