title: Can someone explain why there is a huge difference in speed on Leetcode between using es6 syntax and es5 with typescript?
body: <pre><code>function threeSum(nums: number[], targetSum: number = 0): number[][] {
    if (nums.length &lt; 3) return [];
  
    nums = nums.sort((a, b) =&gt; a - b);
    const triplets: number[][] = [];
    for (let anchorIndex = 0; anchorIndex &lt; nums.length - 2; anchorIndex++) {
      // Remove any duplicates from anchor position before setting up pointers.
      while (nums[anchorIndex] === nums[anchorIndex - 1]) anchorIndex++;
      let leftPointer: number = anchorIndex + 1;
      let rightPointer: number = nums.length - 1;
      while (leftPointer &lt; rightPointer) {
        const [anchorValue, leftValue, rightValue]: number[] = [
          nums[anchorIndex],
          nums[leftPointer],
          nums[rightPointer],
        ];
        const sum: number = anchorValue + leftValue + rightValue;
        if (sum === targetSum) {
          triplets.push([anchorValue, leftValue, rightValue]);
          // Remove any duplicates after finding the target sum.
          while (nums[leftPointer] === nums[leftPointer + 1]) leftPointer++;
          // Traverse one past current Non duplicate value.
          leftPointer++;
        }
        if (sum &gt; targetSum) rightPointer--;
        if (sum &lt; targetSum) leftPointer++;
      }
    }
    return triplets;
  };
  </code></pre>
  <p>This produces 156 ms time to handle the problem.  On other hand if I simply replace the top line with</p>
  <pre><code>const threeSum = (nums: number[], targetSum: number = 0): number[][] =&gt; {
  </code></pre>
  <p>This almost doubles the time to handle the problem (308 ms). Is there something I should be keeping in mind while using typescript?</p>