← Back to challenges

Point Series 1: Skeleton

JavaScriptHardclasses

Instructions

Write a class called Point that represents a point in two-dimensional. It should have the following constructor:

constructor(x, y)

It should have the following properties:

x

y

It should have the following methods:

toString()
  • Returns a string representation of this point, as [x=1, y=2].
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Summing the Squares