JavaScript prefix calculator
For this test we need expected to write a function that evaluates an expression written in prefix notation and returns a value For example expression: + 1 5 variables: {} result_expression: 6 expression: + 1 2 3 variables: {} result_expression: null expression: + 1 variables: {} result_expression: null expression: 9 variables: {} result_expression: 9 expression: * + 1 2 3 variables: {} result_expression: 9 Although negative numeric operands are invalid in expression, intermediate and final results may be negative: expression: + 6 * - 4 + 2 3 8 variables: {} result_expression: -2 Operators and operands must be separated by one or more white spaces: expression: -+1 5 3 variables: {} result_expression: null expression: + 1 2 variables: {} result_expression: 3 Expression containing variables: expression: * + 2 x y variables: { "x": 1, "y": 3 } result_expression: 9