Printing out pi as a symbol instead of the numerical value but calculating with the numerical value in the background in JavaScript

تبليغ
سؤال

يرجى شرح بإيجاز لمإذا تشعر أنك ينبغي الإبلاغ عن هذا السؤال.

تبليغ
‎إلغاء

I am coding a calculator and I want that the calculator is displaying pi as a symbol and not as the numerical value.

My associated function is

function Pi(pi) {

document.getElementById(‘resultArea’).innerHTML += pi
eval(document.getElementById(‘resultArea’).innerHTML) = x
x = 3.1415926

}

And the associated HTML part is:

<td onclick=”Pi(‘π ‘)” class=”changing-button”>π</td>

InnerHTML is a div container or the part where the results are displayed respectively.

‫أضف إجابة

تصفح
تصفح

مجهول يجيب