Arrow function vs Anonymous function with bind

Edit on GitHub

Arrow function vs. anonymous function with bind

Setup

this.value = 1.5;

Tests

  • Arrow function

    for(let i=0; i<1000; i++) {
      () => {
        let result = i * this.value;
      }
    }
  • Anonymous function with bind

    for(let i=0; i<1000; i++) {
      var t = function() {
        let result = i * this.value;
      }.bind(this);
      t();
    }