I
I
Ivanq2015-10-18 09:00:39
JavaScript
Ivanq, 2015-10-18 09:00:39

Calculate string values?

Good morning/afternoon!
I need to embed a calculator on my website. For example, I submit a string to the function input 1 + 2 * 3(not necessarily with spaces, these are users, after all!) I tried to find a similar library, but in vain. I could write it myself, but it will be difficult to process the order of actions, brackets, and I don’t want to build my own bike.
Maybe someone had a similar problem? Eval do not offer.
It is desirable to add the ability to use small functions - for example, like this:

x = 5 * 7
y = x + 5
z = sqrt(y)

PS Preferably without jQuery, only if it doesn't work with pure JS.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2015-10-18
@Ivanq

mathjs.org

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question