calculator - javascript - How do I calculate an JavaScript expression called inside a string? -
i creating simple calculator in html , i've created input field. can type there sum , must calculated. only, don't know how...
example:
have string:
234-231*math.sqrt(9)
is there way calculate sum inside string using javascript?
use eval() function. so: eval("234-231*sqrt(9)");
Comments
Post a Comment