function array_equal ( a, b ) { return a.join('\n&\n') == b.join('\n&\n') ; } var a; alert([array_equal ( [a], [] ),[a].length,[].length]); alert(array_equal ( ['1'], [[1]] ));