https://github.com/khalidsheet/hs-m12-vector
https://github.com/khalidsheet/hs-m12-vector
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/khalidsheet/hs-m12-vector
- Owner: khalidsheet
- Created: 2023-06-14T21:37:11.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-30T17:18:08.000Z (almost 3 years ago)
- Last Synced: 2024-12-26T03:25:06.626Z (over 1 year ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# hs-m12-vector
## Instantiate a new Vector Object
```js
const vector = new Vector(x, y);
```
you can also create a new vector instance by using `of()` static method
```js
const vector2 = Vector.of(x, y);
```
---
## Available Methods
**add(vector)**
Accepts a **Vector** instance
```js
const sum = vector.add(vector2);
```
**abs()**
```js
const abs = sum.abs();
```