Created
June 23, 2023 22:18
-
-
Save kironroy/843cf17b4d15755cba7f1d12e5259453 to your computer and use it in GitHub Desktop.
Matrix2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://stackoverflow.com/questions/6866196/javascript-multiply-and-sum-two-arrays | |
// (4*2+3*3+4*3+5*1). | |
const arr1 = [2, 3, 4, 5]; | |
const arr2 = [4, 3, 3, 1]; | |
console.log(arr1.reduce((r, a, i) => r + a * arr2[i], 0)); | |
// 34 | |
// https://www.w3schools.com/ai/ai_matrices.asp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment