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

Method multiply

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

* Vector scalar multiplication * * @param scalar The factor by which to multiply the vector. * @returns The scaled vector.

(scalar)

Source from the content-addressed store, hash-verified

88 * @returns The scaled vector.
89 */
90 multiply(scalar) {
91 const x = this.x * scalar
92 const y = this.y * scalar
93 return new Vector2(x, y)
94 }
95
96 /**
97 * Distance between this vector and another vector.

Callers 1

Vector2.test.jsFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected