TO Activate the extension:
PC: CTRL SHIFT P > Search for JS EVAL
MAC: CMD SHIFT P > Search for JS EVAL
Then just select the text you want to get evaluated. This extension also gets variables values declared outside of the selected text.
If you want to support me so I can continue developing and extending features, you can buy me a redbull here: https://ko-fi.com/jseval
Evaluate the selected text. A variable can also get its value from other variables.

It is able to evaluate if a variables value is assigned to an expression(Even if the expression itself contains variables).
Selected text inline will also be evaluated correctly.

After an expression you want to calculate has been selected, the result will update live on the statusbar(left bottom corner).
If you encounter any bugs, have any feedback on features you'd like me to implement, don't hesitate to reach out.
JS EVAL is able to use both numbers and variables, even though the variables are defined outside of the selected text. It currently does not support arrays, object and functions, as it is intended for small evaluations and finding the latest assigned value to a selected variable.
Just install and the 'Result' should appear on the statusbar in the bottom left.
Enjoy!