-
|
I'm currently evaluating various functions using Example:
Any mathjs function that accepts a callback or function as an argument seems to not work, but all the functions that don't, do. Am I missing something, or is this a limitation of the library? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
|
Hi, The syntax for arrow functions in javascript is not the syntax for functions in the parser. This is not a function You could try the following and get the expected result. math.evaluate('map([1, 2, 3], _(x) = x+x)')Here is a reference for defining functions. |
Beta Was this translation helpful? Give feedback.
Hi,
The syntax for arrow functions in javascript is not the syntax for functions in the parser.
This is not a function
x => x+x, instead tryf(x) = x+xpersonally if I wont be usingflater I tend to use_(x) = x+xthat will make_into a function but that reminds me I wont be using that later.You could try the following and get the expected result.
Here is a reference for defining functions.
https://mathjs.org/docs/expressions/syntax.html#differences-from-javascript