function calculateDimensions(arr) {
    const dimensions = [];
    let current = arr;
    while (Array.isArray(current)) {
        dimensions.push(current.length);
        current = current[0];
    }
    return dimensions;
}
Calculates the dimensions of a nested array.

@param {any[]} arr The nested array to calculate dimensions for.
@returns {number[]} An array containing the dimensions of the input array.