showing results for - "multiply function javascript"
Nico
29 May 2020
1<!-- Multiplying two numbers in HTML and Javascript -->
2
3<main>
4<label for="firstNum">Number 1:</label>
5<input type="number" id="firstNum" name="firstNum">
6
7<label for="secondNum">Number 2:</label>
8<input type="number" id="secondNum" name="secondNum"></br></br>
9
10<button onclick="multiply()">Multiply</button></br></br>
11
12<label for="result">Result</label>
13<input type="number" id="result" name="result"/>
14</main>
15
16<script>
17function multiply(){
18	num1 = document.getElementById("firstNum").value;
19	num2 = document.getElementById("secondNum").value;
20	result = num1 * num2;
21	document.getElementById("result").value = result;
22}
23</script>
Oskar
07 Mar 2019
1// MULTIPLY FUNCTION
2const multiply = (num1, num2) => {
3  return num1 * num2;
4};
5let resulMultiply = multiply(4, 5);
6console.log(resulMultiply);
7// 20
Francesco
25 Jan 2019
1const multiply = (x,y)=>{
2if(x==1){ return y;}
3else if(x>1){
4return y +multiply(x-1,y)
5}
6else throw "Not Numbers"
7}
8var result = multiply(4,3);
9console.log(result)
Gabriela
12 Mar 2017
1<body>
2<p id = "demo"></p>
3<script>
4       var x = multiply(6, 8)
5       dcument.getElementById("demo").innerHTML = x;
6       function multiply(a, b)
7       {
8       return (a * b)
9       }
10</script>
11</body>
12 
similar questions
queries leading to this page
multiply function javascript