Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. function arguments(input) {
  2. var figure = input.shift();
  3. if (figure == "square") {
  4. let a = Number(input.shift());
  5. let area = (a * a).toFixed(3);
  6. console.log(area);
  7. }
  8. else if (figure == "rectangle") {
  9. let a = Number(input.shift());
  10. let b = Number(input.shift());
  11. let area = (a * b).toFixed(3);
  12. console.log(area);
  13. }
  14. else if (figure == "circle") {
  15. let r = Number(input.shift());
  16. let area = (r * r * Math.PI).toFixed(3);
  17. console.log(area);
  18. }
  19. else (figure == "triangle") {
  20. let a = Number(input.shift());
  21. let h = Number(input.shift());
  22. let area = (a * h / 2).toFixed(3);
  23. console.log("area");
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement