I am trying to make a property in a component read-only. However, it seems like the readonly modifier doesn't do anything at all.
Based on the documentation, I shouldn't be able to modify the cars property declared in AppComponent once I have initialized in the constructor().
What I've tried:
At first I was able to modify cars in AppComponent's ngOnInit() and I thought that this is probably an allowed behaviour because the component is still being "constructed". So I created a button that calls a function and tries to modify the property, yet, again I could do so. So I thought maybe the readonly modifier only applies to outside classes accessing the property. But yet, again I am able to modify cars in HelloComponent.
Am I using readonly wrongly? How do I use it correctly or make a property accessible in public but not "modified-able" (readonly) by outside?