Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function caculation(input){
- let shape = input[0];
- let area = 0;
- let a = Number(input[1]);
- let b = Number(input[2]);
- if(shape == "square"){
- area = a * a;
- }
- else if( shape == "rectangle"){
- area = a * b;
- }
- else if( shape == "circle"){
- area = Math.pow(a, 2) * Math.PI;
- }
- else{
- area = (a * b) / 2;
- }
- console.log(area.toFixed(3));
- }
Add Comment
Please, Sign In to add comment