Is there any idea on how to trigger / detect a changement on a javascript variable ?
the mail goal is to show on every change , the new value of the variable in a span .
I searched on the internet but I found that there is no event or Eventlistner that works with variable
2
Answers
Granted this works if your variable in global.
You may utilize this vanilla JS solution that @twalow has suggested.
But if you want to dive deeper into reactive programming try this stackblitz out
The snippets:
TS:
HTML: