Skip to content

Instantly share code, notes, and snippets.

@kironroy
Created June 23, 2023 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kironroy/843cf17b4d15755cba7f1d12e5259453 to your computer and use it in GitHub Desktop.
Save kironroy/843cf17b4d15755cba7f1d12e5259453 to your computer and use it in GitHub Desktop.
Matrix2
// 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