0

Setting var "i" to the result?

So I was experimenting with JS and encountered a problem. I added a multiply button that will multiply the current number by whatever number you input. But it doesn't set the variable to the result. It just displays the result. How can I set variable i to the result rather than just display the result? https://code.sololearn.com/WvE088j7E2Ka/?ref=app

29th May 2018, 7:10 PM
Daniel Cooper
Daniel Cooper - avatar
4 Respostas
+ 1
Try adding this line in multiply function- i = i *p;
29th May 2018, 7:19 PM
Sachin Artani
Sachin Artani - avatar
+ 1
Thank you. It worked.
29th May 2018, 7:22 PM
Daniel Cooper
Daniel Cooper - avatar
0
This question is very poorly written. To understand what I mean, try multiplying any number. Then try adding or subtracting 1.
29th May 2018, 7:11 PM
Daniel Cooper
Daniel Cooper - avatar
0
😊
29th May 2018, 7:22 PM
Sachin Artani
Sachin Artani - avatar