title: callback is not a function node js
body: <p>I am new to javascript and i am having trouble solving this error. I get the message: "callback is not a function" at:"return callback(rolesArray)". 
  <div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>Rol.getAllRoles = function(callback){
      sql = "select role from Role;";
      var rolesArray = [];
      var role;
      mysql.connection(function(err,conn){
          if (err){
              return callback(err);
          }
          conn.query(sql,function(err,rows){
              if (err){
                  return callback(err);
              }
              for(var i=0; i &lt; rows.length; i++){
                  role = rows[i].role;
                  rolesArray.push(rol);
              }
              console.log("roles: " + rolesArray);
              return callback(rolesArray);
          });
      });   
  } </code></pre>
  </div>
  </div>
  </p>
  
  <p>The console.log outputs:"roles: admin,customer" so the connection with the database works. </p>