I am creating a simple calculator in HTML and I've created an input field. You can type there an sum and it must be calculated. Only, I don't know how...
Example:
I have a string:
234-231*Math.sqrt(9)
Is there a way to calculate this sum inside the string using javascript?
Use the eval() function. Like so: eval("234-231*sqrt(9)");