Open exercise on codesandbox.
I've already imported the ReplaySubject class and the necessary operator functions.
Create a new ReplaySubject and specify the generic type number.
Use the fromEvent creation operator to add an event listener to both the add and sub buttons.
Within the pipe() for each mouse event use the map() operator to map to either 1 or -1 appropriately.
Finally, subscribe to both event listener Observables and set the ReplaySubject instance as the Observer.
Use the EventTarget.addEventListener to add a click event listener to the calc button.
In the callback function, subscribe to the ReplaySubject instance.
Within the pipe() use the scan() operator to sum the next notifications values.
Within the subsribe() method set the value property for the sum input element to the next notification value emitted.