Skip to content

Latest commit

 

History

History
12 lines (11 loc) · 236 Bytes

arrow-function.md

File metadata and controls

12 lines (11 loc) · 236 Bytes

The arrow function () => {} makes writing functions shorter. And maintains this from the outer scope.

function Kata() {
  this.name = 'kata';
  setTimeout(() => {
    alert(this.name); // => 'kata'
  }, 1);
}
new Kata();