repl.it
@kenanhancer/

ArrowFunctionDemo2

ES6

No description

fork
loading
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
var list = [
  'Hydrogen',
  'Helium',
  'Lithium',
  'Beryllium'
];

//ES5
var result1 = list.map(function (s) {
  return s.length;
});

console.log(result1); // logs [8, 6, 7, 9]

//ES6
var result2 = list.map(s => s.length);

console.log(result2); // logs [8, 6, 7, 9]
Babel Compiler v6.4.4 Copyright (c) 2014-2015 Sebastian McKenzie
?