Skip to content

Instantly share code, notes, and snippets.

@padolsey
Created July 18, 2012 07:47
Show Gist options
  • Save padolsey/3134886 to your computer and use it in GitHub Desktop.
Save padolsey/3134886 to your computer and use it in GitHub Desktop.
JS challenge

Implement Point so that:

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

Must be generic and be able to handle x and y values from 0..999 (integers only)

Minor hint: you'll need to implement valueOf and toString methods.

@avipinto
Copy link

mine: https://gist.github.com/3138260
it was fun :)

@dundalek
Copy link

Trying to make it as shortest as possible, which is an usual goal of theese challenges :)
https://gist.github.com/3139898
(String-based solution, handles floats)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment