Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@raynerpupo
Created March 9, 2018 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raynerpupo/a04c00160e462d5ddab7149b51c514b1 to your computer and use it in GitHub Desktop.
Save raynerpupo/a04c00160e462d5ddab7149b51c514b1 to your computer and use it in GitHub Desktop.
JS Prototyping exercise

#Shapes Using the new ES6 features related to prototyping, implement a small library to define geometric shapes (not visually) and allow basic calculations. ###Requirements

  • The shapes to define are Circle, Square and Rectangle.
  • All shapes must define a function to calculate the area and perimeter .
  • Use a only positive coordinate system (implement validations while building the shapes or changing its properties).
  • Implement a predicate function collidesWith to check if the shape collides with another shape of the same type.
  • Given a list of shapes, print its properties and the area and perimeter properties.
  • All functionalities should be properly tested.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment