Calculate string value in javascript, not using eval

pimvdbEric Herlitz提出了一个问题:Calculate string value in javascript, not using eval,或许与您遇到的问题类似。

回答者fedmichTroy SK给出了该问题的处理方式:

This exactly the place where you should be using eval, or you will have to loop through the string and generate the numbers. You will have to use isNaN method to do it.

希望本文对你有帮助,欢迎支持JavaScript中文网