4 ms·
Opened page and saw the animation function nameLength(name){ return name.length } Rather than const nameLength = (name) => name.length This is already
by vorticalbox 8y ago
Opened page and saw the animation
function nameLength(name){
return name.length
}
Rather than
const nameLength = (name) => name.length
This is already enough for me not to bother looking.
- bytematic 8y agoWhich is a completely useless function anyway
- vorticalbox 8y agoMaybe, depends on what you're doing. Going full functional style could possibly be used.
- rhinoceraptor 8y agoYou could change it to pointfree using Ramda and just write: const length = prop('length')
- kyle_v 8y agowhy not just name.length
- plausibilities 8y agoconst length = (string) => (string.length) It is unnecessary to adopt a naming convention which implies a scope within the context of "names" when the method is compatible with all strings.
- vorticalbox 8y agoIt was more about the lack of es6 syntax but yes 100% agree
- jadjoubran 8y agoES6 is explained in detail, with implicit return in Chapter 5 (or 6). Developers still need to know the function syntax for when they look up documentation online Cheers!