How to create a function calculator? [Programming Interview Question]
@Yomesh Gupta

JavaScriptIntermediate
1396
Do you see value in our efforts?

Devtools Tech is a free platform for Frontend Engineers. It takes a lot of time, effort, and finanical resources to keep the platform running. If you see any value in our work and would like to support us then you can do using the following options.

InternationalDomestic

Create a function calculator that should take one initial value. Chain calulations like add, subtract on it. It shoudl return the calculated value on invocation of val function at the end of the chain.

var output = cal(2).add(5).sub(4).val();

Output should be: 3 (2 + 5 - 4)

Loading IDE...