title: How to convert OOP to FP in JavaScript
body: <p>I'm having this code in JavaScript</p>
  <pre><code>class StringFormatter {
  
   init(locale) {
    this.locale = locale;
   }
  
   getA() {
    return 'A' + this.locale
   }
  
   getB() {
    return 'B' + this.locale
   }
  
   getC() {
    return 'C' + this.locale
   }
  
  }
  
  
  // when page just render
  let stringManager = new StringFormatter();
  stringManager.init('enUS');
  // call it in other components 
  let result = stringManager.getA();
  </code></pre>
  <p>so when I'm using this OOP class, I only need to set the <code>locale</code> once by <strong>init</strong> it when page first render. And then all of the later code where I call methods <code>getA, getB or getC</code> will adapt to this <code>locale</code>.</p>
  <p>Now as I want to move this to a more <strong>Functional Programming</strong> way, how can I write it but still keep the same concept. Right now I can only come up with this solution</p>
  <pre><code> getA(locale) {
    return 'A' + locale
   }
  
   getB(locale) {
    return 'B' + locale
   }
  
   getC(locale) {
    return 'C' + locale
   }
  
  let result = getA('enUS');
  </code></pre>
  <p>But this one required me to keep passing the <code>locale</code> every time I call the function <code>getA, getB or getC.</code></p>
  <p>Is there anyway that we somehow still can config the locale but only <strong>once</strong>, don't need to pass it every time to <code>getA, getB or getC</code> function, and <strong>don't need to write in OOP way</strong>?</p>