Javascript Challenges

Point

This challenge needs you to implement a Point class so that the following code returns true.

new Point( new Point(10, 20) + new Point(30, 50) ).toString() === '{40,70}';

Exercise

Correct!
False!

Implement Point and assume that:

  • Must be generic and be able to handle x and y values from 0..999
  • The requirements to do it are to implement valueOf and/or toString methods.