function dot(arr1, arr2) {
    let result = 0;
    for (let i = 0; i < arr1.length; ++i) {
        result += arr1[i] * arr2[i];
    }
    return result;
}
Calculates the dot product of two arrays.
@param {number[]} arr1 The first array.
@param {number[]} arr2 The second array.
@returns {number} The dot product of arr1 and arr2.