DEV Community

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

Collapse
 
j7222 profile image
J7222 • Edited

let x=['1',2,5,6];
let y= [1,2,5,6];
let xlenx = x.length;
for(let i=0;i<xlenx;i++){
if(x[i]==y[i]){

console.log(x[i] + ' == ' + y[i])
}
else if(x[i]!==y[i]){
console.log('not same');
break;
}}