Home >Web Front-end >JS Tutorial >js implements a method similar to the add(1)(2)(3) calling method_javascript skills
That’s right! If there are four calls like add(1)(2)(3)(4), then this will definitely not apply.
This is similar to executing a function and returning the value of the function itself:
But after the calculation is completed, the tmp function is still returned, so the calculation result cannot be obtained. The result we need is a calculated number. So what should we do? First, we must know how to print and add calculations in JavaScript. , will call the toString or valueOf function respectively, so we rewrite the toString and valueOf methods of tmp to return the value of sum;
The above is the entire content of this article, I hope you all like it.