Check whether two JavaScript arrays are equal, using basic library only
Your function should be dedicated to its functionality. Have all the printing done externally. You don't need testName as a parameter.
Have your function return true or false. It's much more useful and reusable that way. Having it return also allows you to exit the function early if you know the arrays are not equal. For example:

function assertArraysEqual(actual, expected) {
    if (actual.length !== expected.length) {
        return false;
    }
    ...

If this is for something like unit testing, you should use a unit test library to like Mocha or Qunit to validate the behavior of the function.
What data types are you dealing with? Are you only concerned with numbers? Do you want strict type checking and/or null checking?


If you're only concerned with validating arrays of numbers and you know the bounds of the input, you can easily rewrite your function like so:

    function assertArraysEqual(actual, expected) {
        if (actual.length !== expected.length) {
            return false;
        }
        for (var i = 0; i &lt; actual.length; ++i) {
            if (actual[i] !== expected[i]) {
                return false;
            }
        }
        return true;
    }