Calculates a dot product of the given vectors. Returns a scalar.

Type signature

(
  [a, b]: [number, number],
  [c, d]: [number, number]
) => number

Examples

dot([3, 5], [-1, 8]);
// ⇒ 37
Try in REPL
dot([3, 5], [-1, -8]);
// ⇒ -43
Try in REPL

Questions

  • How to compute a dot product of two vectors?

TypeScript sourceJavaScript source