title: Javascript arrow function inside case statement
body: <p>I wish to know how to implement an arrow function inside a case statement.
  Please what is the way to obtain for example 15 into 'result' if I do something similar?</p>
  
  <pre><code>var result = num.calculate('+');
  </code></pre>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var num = {
    x: 12,
    y: 3,
    calculate: function(operation) {
      var fn;
      switch (operation) {
        case '+':
          fn = function() {
            return this.x + this.y
          };
          break;
        case '-':
          fn = function() {
            return this.x - this.y
          };
          break;
        default:
          fn = function() {};
      }
      return fn();
    }
  }</code></pre>
  </div>
  </div>
  </p>