If you use the keyword var
*INSIDE* of a function, then all variables thus defined are accessible *ONLY* in that function.
When you return a value from a function, that return value WILL BE IGNORED unless it is assigned to a variable by the caller or used in some expression by the caller.
So, just for example, when you did
getvolume(length, width, height);
that call was useless. Because the function declared the variable v
inside itself and so it is invisible outside the function *AND* you then ignored the value returned by the function.
A reasonable thing to do would have been something like
var volume = getvolume(length, width, height);