Hello,
I’m trying to perform simple javascript functions. I want to execute the following operations: addition, subtraction, multiply, division, and a even odd function.
So far I did the addition. Its not working and I was wondering if someone can offer help. Here’s what I have so far.
My HTML:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html>
<head>
<title> </title>
<script src=“ron3.js” type=“text/javascript”></script>
<link href=“ron3.css” type=“text.css” rel=“stylesheet”/>
</head>
<body>
<script src=“ron3.js” type=“text/javascript”>
document.writeln(add(10,2));
</script>
</body>
</html>
And then my external js file:
function add(num1+num2)
{
return num1 + num2;
}
In the book I’m reading, it shows me how to get the area of a rectangle by using: function CalcArea
var area (length* width);
return area;
I was thinking that instead of the function name add for addition I should use CalcSum. If anyone can direct me to a site that lists the function names for the operations I mention above, that would be great. My book seems to only cover area and leave the rest up to me.
Thanks