DEV Community

Discussion on: Simplest way to compare two numbers array in JS

Collapse
 
jt3k profile image
Andrey Gurtovoy • Edited
compareArr = (arr1, arr2) => {
  if(arr1.length !== arr2.length){ return false;}
  return arr1.every((item, index) => item === arr2[index]);
};
Enter fullscreen mode Exit fullscreen mode

// Is better for your task