Skip to content

Instantly share code, notes, and snippets.

@StaniTr

StaniTr/Circle Area

Created Jul 14, 2014
Embed
What would you like to do?
//function calcSircleArea(r) - func with parameter r (radius)
function calcCircleArea(r){
//area
var area=Math.PI*r*r;
return area;
//console.log(arguments); --prints arguments of the function
}
function printArea(){
document.getElementById('print').innerHTML='r = 7 area= '+calcCircleArea(7)+'</br>'+ 'r= 1.5 area ='+calcCircleArea(1.5)+'</br>'+ 'r= 20 area ='+calcCircleArea(20);
}
window.onload=printArea;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.