본문 바로가기
알고리즘/Codewars

[Codewars] Surface Area and Volume of a Box (8 kyu) / JavaScript

by fluss 2023. 3. 29.

https://www.codewars.com/kata/565f5825379664a26b00007c

 

Codewars - Achieve mastery through coding practice and developer mentorship

A coding practice website for all programming levels – Join a community of over 3 million developers and improve your coding skills in over 55 programming languages!

www.codewars.com

 

DESCRIPTION:

Write a function that returns the total surface area and volume of a box as an array: [area, volume]

 

코드

function getSize(width, height, depth){
  return [2 * (width * height + height * depth + width * depth), width * height * depth]
}
 

댓글