Function compares only the first value instead of all values in an array

My function compares only the first value in the array. What is the problem?

var areArraySame = function(one, two){
  for(var i=0;one[i] === two[i];i++){
    return(console.log("true"));
  }
};
console.log(areArraySame([1,0,5,5,2,2] , [1,6,5,5,2,2]));


ANSWERS:


Because you return from the for loop. Return breaks function execution and returns the control to the caller.

var areArraySame = function(one, two){
  for(var i=0;one[i] === two[i];i++){
    console.log("true");
  }
};
areArraySame([1,0,5,5,2,2] , [1,6,5,5,2,2]);

var areArraySame = function(one, two){
  var same = true;
  for(var i=0;i < one.length;i++){
    if (one[i] !== two[i]) {
        same = false;
        break;
    }
  }

  console.log(same);
  return same;
};

console.log(areArraySame([1,0,5,5,2,2] , [1,6,5,5,2,2]));


 MORE:


 ? How to keep a constant value of a variable during the execution of the code in Matlab
 ? How to get out of this cycle?
 ? sql - how to cycle a foreign key to obtain a cycled list of elements?
 ? Stylus 'for' cycle: possible to combine range and single values?
 ? How to detect when the app goes to minimized or exit
 ? PHP Auto Increment a (float) column from another column data
 ? Launch/raise application and cycle through its windows using AppleScript and keyboard shortcut
 ? I don't understand the behavior of char in this example
 ? THREE.js smooth material color cycle in separate geometries
 ? Scala - Use DFS for detecting a cycle? My code is buggy, and I can't seem to figure out why