Question regarding calculator : | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Question regarding calculator :

Finally I made a calculator , but I struck at a point , I defined a function to for finding the factorial of any number , first I added the symbol like this . function f(val) { document.getElementById('d').value+=val; } I don't know now how will I give the factorial as output on the screen of my calculator , Plz help . Note : Plz don't write down the portion to find the factorial , I already know it , just tell how can I display it . Thanks in Advance .

22nd Jul 2017, 3:49 PM
RZK 022
RZK 022 - avatar
2 Answers
+ 6
I don't know javascript much but this may work suppose you have stored the factorial in variable "x" then var y = document.getElementById('d'); y.innerHTML = x;
22nd Jul 2017, 4:38 PM
cHiRaG GhOsH
cHiRaG GhOsH - avatar
+ 1
That's not possible it becomes an error . Is there any other way. I tried to store the factorial as an exception and then define it in the last , but then the value of "value" and "val" came out of function . And then its again an error .
23rd Jul 2017, 4:11 AM
RZK 022
RZK 022 - avatar