bobo_bobkata

Untitled

Oct 8th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. solution = {
  2. 'add': (x, y) => [(x[0] + y[0]), (x[1] + y[1])],
  3. 'multiply': (x, y) => [(x[0] * y), (x[1] * y)],
  4. 'length': x => Math.sqrt((x[0] * x[0] + (x[1]) * (x[1]))),
  5. 'dot': (x, y) => x[0] * y[0] + y[1] * x[1],
  6. 'cross': (x, y) => x[0] * y[1] - x[1] * y[0]
  7. }
Add Comment
Please, Sign In to add comment