borisova936935

Untitled

Oct 11th, 2021
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. figures = (Data) => {
  2.     switch (Data[0]) {
  3.         case 'square' : return (Math.pow(Data[1],2)).toFixed(3);
  4.         case 'rectangle': return (Data[1] * Data[2]).toFixed(3);
  5.         case 'circle': return (Math.PI * Math.pow(Data[1],2)).toFixed(3);
  6.         case 'triangle': return ((Data[1] * Data[2])/2).toFixed(3);  
  7.     }
  8. }
  9. figures(["square", "7", "2.5"])
Advertisement
Add Comment
Please, Sign In to add comment