1

I saw many code snippets which has =>

symbol in typescript file. Could any one explain what is the exact meaning and why to use.

RKCY
  • 4,095
  • 14
  • 61
  • 97
  • 1
    it's the es6 arrow function. – toskv Sep 15 '16 at 14:28
  • what is the arrow function ? why using this symbol for function ? – RKCY Sep 15 '16 at 14:28
  • 2
    you should really just google that, stackoverflow is meant to help you with issues you are having in code not give explanations. :) – toskv Sep 15 '16 at 14:30
  • 1
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions – toskv Sep 15 '16 at 14:30
  • It's a closure whose scope remains unchanged. If you used `jQuery.proxy`, then `() => {}` is equivalent to `$.proxy(function(){}, this);` – Mjh Sep 15 '16 at 14:35
  • 2
    Possible duplicate of [What's the meaning of "=>" (an arrow formed from equals & greater than) in JavaScript?](http://stackoverflow.com/questions/24900875/whats-the-meaning-of-an-arrow-formed-from-equals-greater-than-in-javas) – Oriol Sep 15 '16 at 15:44

1 Answers1

1

=> is a lambda function. For a great intro take a look here, or the documentation here.

Ross Scott
  • 1,690
  • 9
  • 16