var a = [1,2,3]; var b = [1,2,3,4,5,6]; function array_equal ( a, b ) { return a.every(function(el, i){ return el == b[i]; }, b); } alert(array_equal ( a, b ));