title: Javascript: calling function inside another function not working?
body: <p>So inside my <code>&lt;script&gt;</code> tags, I have these functions.</p>
  
  <pre><code>$.fn.getRandom = function(min, max) {
      return min + Math.floor(Math.random() * (max - min + 1));
  }
  
  function placeRandom() {
      alert(getRandom(1,7));
  }
  </code></pre>
  
  <p>and I call the <code>placeRandom()</code> function like so</p>
  
  <pre><code>$(document).ready(function() {
      placeRandom();
  });
  </code></pre>
  
  <p>when I do this, it gives me an </p>
  
  <pre><code>Object expected
  </code></pre>
  
  <p>error and refers to the line where I wrote </p>
  
  <pre><code>alert(getRandom(1.7));
  </code></pre>
  
  <p>Now, my main question is if there is anything wrong with the code which I am showing you, or does it look correct? Because if it looks correct then I think i'm going to have to run through the rest of my entire code and look for maybe a open bracket which isn't closed because that might be the problem. So yea, is there any problem with my placeRandom() or getRandom() function or is the error occuring because of another reason other than these functions?</p>