# Getting "NAN" in java

i am starting to learn how any of this works. javaScript has been hard for me to understand the most so far, ie working the functions, if/ else etc. i am in the middle of working with helper functions at this time. since i have been having issues with it i have been playing around with it more after each section. i decide to try it with simple geometry formulas. when i went to find the area of a triangle it gave me the response of “NaN”. I remember that it stands for not a number but there is nothing but positive integers inside of the formulas. i cant find out how it is getting that response. any help would be greatly appreciated.

here is the code i used:
/* area of tirangle formula 1/2(base*height) */
function areaOfTriangle(base,height)
{ return base * height}

function newAreaOfTriangle(base,height)
{ return areaOfTriangle / 2; }

const fullArea= newAreaOfTriangle( 16, 12);
console.log(fullArea);

i followed another steps i used for the area of a semi-circle as well but that equation came out correct.
once again any help would be appreciated!!! thanks in advance

Hello @py3767585886 welcome to the forums. I believe your problem is with this:

You are calling the `areOfTriangle` function with no parameters, yet it accepts(and in this case requires) two.

``````/*your code*/
function newAreaOfTriangle{
return areaOfTraingle / 2;//areOfTriangle is missing parameters!
}
/*what it should be*/
function newAreaOfTriangle(base, height) {
return areaOfTriangle(base, height) / 2;
}
``````

The reason it is return `NaN` is because this function:

Accepts two parameters, but you aren’t giving any. This means the function is multiplying nothing(`NaN`) by nothing(`NaN`). This results in nothing(`NaN`).
I hope this helps/