convert a string of a math formula to Object Tree in Javascript?
a function that converts a math string passed as a prop (with the operations + , - , / , * ) by returning an object that contains pieces of the math string, in an ordered/better way easier to loop on it then. test cases if you need them: Example 1: Basic Math (same operation) N Input (string) Output (object) 1 1 { values: [1], operation: null } 2 1+1 { values: [1,1], operation: "+" } 3 1+2+3 { values: [1,2,3], operation: "+" } 4 3-2-1 { values: [3,2,1], operation: "-" } 5 10*80 { values: [10,80], operation: "*" } 6 100/10 { values: [100,10], operation: "/" } Example 2: Formula with 2 operations ➡️ + and - samples N1 input: 1+1-1 output: { values: [ { values: [1, 1], operation: "+", }, 1, ], operation: "-", }; N2 input: 3+2-1+5 output: { values: [ { values: [ { values: [3, 2], ...