Skip to content

Parser throws error when defining a function in a multiline expression #405

@josdejong

Description

@josdejong

The following works fine:

var scope = {};
math.eval('f(x) = x^2', scope);
scope.f(3); // 9

but when having a multiline expression containing a function definition, we get an error:

var scope = {};
math.eval('a=2; f(x) = x^a', scope);  
    // Uncaught SyntaxError: missing ) after argument list

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions