MCPcopy Create free account
hub / github.com/TheAlgorithms/JavaScript / add

Method add

Data-Structures/Vectors/Vector2.js:66–70  ·  view source on GitHub ↗

* Vector addition * * @param vector The vector to be added. * @returns The sum-vector.

(vector)

Source from the content-addressed store, hash-verified

64 * @returns The sum-vector.
65 */
66 add(vector) {
67 const x = this.x + vector.x
68 const y = this.y + vector.y
69 return new Vector2(x, y)
70 }
71
72 /**
73 * Vector subtraction

Callers 1

Vector2.test.jsFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected