Last active
July 3, 2019 02:40
-
-
Save wongjiahau/d9e6a9276cccdf61b850b9f57ff174d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getArea = (shape: Shape) => { | |
switch(shape.label) { | |
case 'circle': return Math.PI * Math.pow(shape.radius, 2) | |
case 'triangle': return 0.5 * shape.base * shape.height | |
case 'rectangle': return shape.height * shape.width | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment