How do you divide an equation into numbers?

Hello everyone! An equation is entered into the input. When the button is pressed, it must be split into numbers with a sign in front of it For example the equation (I made it up myself): 59 + 3x5 = 45 + 6x and js should divide it into:
famous: 59, 5, 45
unknown: + 3x, + 6x
how to do it?JavaScript Lorelei Sherman, Oct 18, 2020 
You can get constants and variables, and solve it, with algebra.js :
const left = new algebra.Expression('x')
.multiply(3)
.add(59)
.subtract(5);
const right = new algebra.Expression('x')
.multiply(6)
.add(45);
const expression = new algebra.Equation(left, right);
console.log(`${expression} => ${expression.solveFor('x')}`); // 3x + 54 = 6x + 45 => 3Molly Rowe
1 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!