javascript_fns
javascript_fns
Example
Calculate the product of two numbers, and return the result:
function myFunction(a, b) {
return a * b; // Function returns the product of a
and b
}
12
<html>
<head>
<script type="text/javascript">
var count = 0;
function countVowels(name)
if(name[i] == "a" || name[i] == "e" || name[i] == "i" || name[i] == "o" || name[i] == "u")
count = count + 1;
document.write("Hello " + name + "!!! Your name has " + count + " vowels.");
countVowels(myName);
</script>
</head>
<body>
</body> </body>
</html>
<html>
<head>
<script type="text/javascript">
return sum;
}
var firstNo = 78;
</script>
</head>
<body>
</body>