3 ms·
ES6 const atLeastTwo = x => Math.max(2,x)
by WalterSear 9y ago
ES6
const atLeastTwo = x => Math.max(2,x)
- leshow 9y agohis is a function that returns a function, i.e. you'd need to call atLeastTwo(x)(); to get a result, yours is just a function. in es6 the equivalent thing to what he wrote would be: const atLeastTwo = x => () => Math.max(2, x);