Simplified some JavaScript code by adding a helper function.
Simplified some JavaScript code by adding a helper function.

katie356/BrainwaveAnalyzer,katie356/BrainwaveAnalyzer,katie356/BrainwaveAnalyzer