title: Javascript : Returning a property map from a function
body: <p>Here is my code `   </p>
  
  <pre><code>function currentCursPos(){
  $(document).mousemove(function(e){ var pos= {"x":e.pageX,"y":e.pageY}; return pos });
  }
  function clrpckrTopPos(){
      //var cursorPos={};
      var cursorPos=currentCursPos();
      if(cursorPos.y&lt;$("#colorpickerDiv").height()){return cursorPos.y+$("#colorpickerDiv").height()}
      if(cursorPos.y&gt;$("#colorpickerDiv").height()){return cursorPos.y}//colorpickerDiv2 and colorpickerDiv have same height
  }   `
  </code></pre>
  
  <p>.
  I get the error that 'cursorPos is undefined'
  .
  Any ideas how to achieve the task of returning a property map from a function. What mistake I am making ?</p>