title: Javascript: Callback is not a function
body: <p>roll() function working nice, but when i'm trying to get callback it's throws error: callback is not a function    </p>
  
  <pre><code>var speed = 300;
  function roll(callback) {
    if (typeof callback === "function") {
      console.log('callback is function!'); //yes
    }
    if (speed &lt; 1000) {
      speed += 50;
      setTimeout(roll, 1000); //increase speed
    } else if (speed &gt;= 1000) {
      console.log('finished');
      return callback(true); //problem here?
    }
  }
  roll(function(callback) {
    console.log(callback); //callback is not a function
  });
  </code></pre>