As I'm starting to learn Angular I keep coming across sentences like 'don't forget to destroy the X in ngOnDestroy', where X might be something like a Subscription
In C++ there are smart pointers (probably, I'm 15+ years out of date). Are there any equivalents in Angular/Javascript?
So here
this.numberStream = obNumberStream.subscribe(
....
You would instead have something like numberStreamPtr, you would reference the Subscription functions like numberStreamPtr().XXX, and most importantly, you wouldn't need to call unsubscribe because it would be called automatically when the component destroy was called