admin管理员组文章数量:1291097
I normally have understood this stuff well as I am taking web programming for a non-major class and guess I am just a little confused on what I'm being asked to do.
I am told to "Write a function named "MULTIPLY" that accepts 2 parameters. the function will be declared this way:
function MULTIPLY(parameter1, parameter2){
//The parameter names can be whatever you want
//Your code goes here
};
I have wrote this as my code :
function MULTIPLY (price, shipping) {
return price*shipping;
enter code here
product=number1*number2;
//return the result
return total;
I normally have understood this stuff well as I am taking web programming for a non-major class and guess I am just a little confused on what I'm being asked to do.
I am told to "Write a function named "MULTIPLY" that accepts 2 parameters. the function will be declared this way:
function MULTIPLY(parameter1, parameter2){
//The parameter names can be whatever you want
//Your code goes here
};
I have wrote this as my code :
function MULTIPLY (price, shipping) {
return price*shipping;
enter code here
product=number1*number2;
//return the result
return total;
Share
Improve this question
edited Dec 21, 2014 at 19:43
Deduplicator
45.7k7 gold badges72 silver badges123 bronze badges
asked Oct 21, 2014 at 21:04
terryterry
211 gold badge1 silver badge2 bronze badges
1
-
1
Your code is missing the
}
at the end. You also left in StackOverflow'senter code here
. Please show what you actually wrote. – Barmar Commented Oct 21, 2014 at 21:07
2 Answers
Reset to default 2<script>
function multiplyNumbers(x,y){
return x*y;
}
var z= multiplyNumbers(4,5); // Function is called, return value will end up in z
</script>
<button onclick="document.getElementById('multiplication').innerHTML=z;">Multiply numbers</button>
<p id="multiplication"></p>
You have a few problems. Here is how it should look
function MULTIPLY(price, shipping) {
//Return the sum
return price*shipping;
}
//Call MULTIPLY to multiply the two numbers
var product=MULTIPLY(number1, number2);
本文标签: functionJavascript Multiplying 2 numbers and return numberStack Overflow
版权声明:本文标题:function - Javascript- Multiplying 2 numbers and return number - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741502355a2382119.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论