JavaScript - For loop not working : <p>so i have this code where i pass two arrays to the function "addPlayers" and in the funcion i loop trough the arrays to make a string, but the second loop does not wants to work. Here is the code:</p>

<pre><code>$("#btnSend").on("click", function(){

    var  mPlayers = $("#txtJugadores").val().split("/");
    var  mRoles = $("#txtRoles").val().split("/");
    /*here i call the function with the two arrays*/
    addPlayers(mPlayers,mRoles);
    /*Here a console.log prints that mPlayer is an array with 2 
      numbers and that mRoles is an array with 2 numbers wich is good*/
  });




 function addPlayers(players, roles){

    var players_list = "";
    /*this loops works fine*/
    for (var i = 0; i &lt; players.length; i++) {
            players_list = players_list + players[i] + "/"; 
        }   

    var roles_list = "asd";
    /*but this loop don't*/
    for (var n = 0; n &lt; roles.lenght; n++) {
            roles_list = roles_list + roles[n] + "/";

    }
    console.log(players_list); /*here the console prints the string 
                                 with the two numbers plus the */
    console.log(roles_list);/*but here the console prints "asd" */




 }
</code></pre>

<p>The second loop should work like this first one but it doesn't.</p>
