Further simplified JavaScript code by updating the helper function.
Further simplified JavaScript code by updating the helper function.

katie356/BrainwaveAnalyzer,katie356/BrainwaveAnalyzer,katie356/BrainwaveAnalyzer