Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Introducing the Practice

My solution for Functions - Calculating Volume and Areas!

//area of Rectangle function declaration
function areaRectangle(width, height){
  return width * height;
}

//volume of a Rectangular Prism function declaration
function volumeRectangularPrism(width, height, length){
  return width * height * length;
}

//area of a circle function declaration
//The area of a circle is the value of π * radius^2
function areaCircle (radius){
  return Math.PI * Math.pow (radius,2); 
}


//volume of a Sphere function declaration
//    The volume of a circle is: 4/3 *  π * radius^3
function volumeSphere ( radius){
  return 4/3 * Math.PI *Math.pow ( radius,3);
}



console.log(areaRectangle(5, 22));
console.log(volumeRectangularPrism(4.5, 12.5, 17.4));
console.log(areaCircle(7.2));
console.log(volumeSphere(7.2));

YAY!