Skip to content

Instantly share code, notes, and snippets.

@StaniTr
Created July 14, 2014 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StaniTr/3e06226352c78961551f to your computer and use it in GitHub Desktop.
Save StaniTr/3e06226352c78961551f to your computer and use it in GitHub Desktop.
//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