function createArrayDepth(dimensions, endpoint) {
    var currentDimension = dimensions[0];

    var newArr = new Array(currentDimension);
    for (var i = 0; i < currentDimension; i++) {
        var value = endpoint;
        if (dimensions.length > 1) value = createArrayDepth(dimensions.slice(1), endpoint);
        newArr[i] = value;
    }
    return newArr;
}
function createArrayDepth(dimensions, endpoint) {
    var currentDimension = dimensions[0];

    var newArr = new Array(currentDimension);
    for (var i = 0; i < currentDimension; i++) {
        var value = endpoint;
        if (dimensions.length > 1) value = createArrayDepth(dimensions.slice(1), endpoint);
        newArr[i] = value;
    }
    return newArr;
}
function createArrayDepth ( dimensions , endpoint ) { var currentDimension = dimensions [ 0 ] ; var newArr = new Array ( currentDimension ) ; for ( var i = 0 ; i < currentDimension ; i ++ ) { var value = endpoint ; if ( dimensions . length > 1 ) value = createArrayDepth ( dimensions . slice ( 1 ) , endpoint ) ; newArr [ i ] = value ; } return newArr ; }
Creates an array with the specified lengths of dimensions

@param {Array<Number>} dimensions The array dimensions
@param {*} endpoint The value for the array endpoint
@private
Creates an array with the specified lengths of dimensions