JSFiddle - React, Tailwind, and code Playground

by Professor Tom DeDonno

HTML

<p id="sqrt"></p>
<p id="volume"></p>
hello

JavaScript

/* 
@author Professor Tom DeDonno  page 75 TextBook
keyword function, functions return one value 
*/

function calculateSquareRoot( number ) {
	
	//we never do this use the Math class 
	return Math.sqrt( number );
}

function calculateVolume( length, width, height ) {
	
	//var volume = length * width * height 
	//used once so I'm not declaring it
	return length * width * height;
}
function sum( num1, num2 ) {return num1+num2;}
function sum3( num1, num2, num3){
	return sum( sum( num1, num2), num3);
}
/** call the functions */
document.getElementById( "sqrt" ).innerHTML = calculateSquareRoot( 4.0 );
document.getElementById( "volume" ).innerHTML =
calculateVolume( 2, 2, 2 );
let finalTotal = sum3( 1,2,3) + sum3( 4,5,6 );