0

This is about my js calculator

The problem is somehow hard to explain, For normal calculation,it has no problem.It works perfectly because of eval in js. But for complicated problem like permutation and combination,in which i have to write my own calculation code,once i have pressed the cancel button and try to perform e.g sine it still holds the previous answer and there fore giving me null e.g 3p2 will give me e.g 6 but then when I press ac whichwill clear my div I.e the place where my answer appears and I try sin 30 it gives me NaN. am thinking it is because it still considers that 6 from the previous answer and does 6sin30 so please who knows a way that when i clear the div,it clears any previous values I have written

2nd Jan 2019, 3:53 PM
Fakorede Damilola
2 odpowiedzi
0
this is a link to the code I did not separate it cause it giving me an error when I do I don't know why https://code.sololearn.com/WPDRD00rPCQZ/?ref=app
2nd Jan 2019, 4:46 PM
Fakorede Damilola
0
no no at first it does not work but when you perform the first operation,and press ac I.e clear and you try another operation, it gives NaN if that operation is like P or r etc
2nd Jan 2019, 5:51 PM
Fakorede Damilola