The average of a field in array of objects : <p>I have the following array of objects:</p>

<pre><code>[
    {
        items: {
            "1554038371930_ajhnms9ft" : {
                "mark" : 5
            },
            "1554038905938_le34li2cg" : {
                "mark" : 2
            },
            "1554039157958_kwab8rj5f" : {
                "mark" : 4
            },
            "1554039174126_p47ugwkbv" : {
                "mark" : 1
            }
        }
    },
    {
        items: {
            "1554038371930_ajhnms9ft" : {
                "mark" : 1
            },
            "1554038905938_le34li2cg" : {
                "mark" : 5
            },
            "1554039157958_kwab8rj5f" : {
                "mark" : 5
            },
            "1554039174126_p47ugwkbv" : {
                "mark" : 2
            }
        }
    },
    {
        items: {
            "1554038371930_ajhnms9ft" : {
                "mark" : 4
            },
            "1554038905938_le34li2cg" : {
                "mark" : 3
            },
            "1554039157958_kwab8rj5f" : {
                "mark" : 3
            },
            "1554039174126_p47ugwkbv" : {
                "mark" : 4
            }
        }
    },
    {
        items: {
            "1554038371930_ajhnms9ft" : {
                "mark" : 1
            },
            "1554038905938_le34li2cg" : {
                "mark" : 2
            },
            "1554039157958_kwab8rj5f" : {
                "mark" : 5
            },
            "1554039174126_p47ugwkbv" : {
                "mark" : 4
            }
        }
    }
]
</code></pre>

<p>and i want to get the average of chack item, so the result will be the following:</p>

<pre><code>{
    items: {
        "1554038371930_ajhnms9ft" : {
            "mark" : 2.75
        },
        "1554038905938_le34li2cg" : {
            "mark" : 3
        },
        "1554039157958_kwab8rj5f" : {
            "mark" : 4.25
        },
        "1554039174126_p47ugwkbv" : {
            "mark" : 2.75
        }
    }
}
</code></pre>

<p>which is the best way to achieve that?</p>
