Skip to content

"Expression parsing and evaluation" typo #2959

@Eli-Black-Work

Description

@Eli-Black-Work

Describe the bug
The documentation at https://mathjs.org/docs/expressions/parsing.html#parser has this example:

// create a parser
const parser = math.parser()

...

// define variables and functions
parser.evaluate('x = 7 / 2')            // 3.5
parser.evaluate('x + 3')                // 6.5
parser.evaluate('f(x, y) = x^y')        // f(x, y)
parser.evaluate('f(2, 3)')              // 8

// get and set variables and functions
const x = parser.get('x')               // x = 7

Shouldn't the last line return 3.5 instead of 7?

e.g.

const x = parser.get('x')               // x = 3.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdocumentationConcerns about or enhancements to the mathjs documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions