Its hard to say from the given information. I will say setting Local Storage every 0.1 seconds is a bad practice as its set up to be asynchronous, and will likely take longer than 0.10 seconds to complete occasionally.
Global, and local variables are a better match for this.