Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@pagrette that's equal to var x = person.name
You can do something like :
var { name: x, surname: y, age: z } = person -
pagrette897yOk I see thanks.. but I don't like, it's very not a clear way so source code is not easy to read
-
@pagrette terrible readability, but better than repeating the code over and over; x = person.name, y = person.age, etc.
-
nmunro31907yIt's really not very 2017 if you're still using var... Better to use let or const as appropriate.
Otherwise yeah, little weird looking, but if it's unclear, comment it! -
The thing where ES6 starts to confuse is nested higher order arrow functions.
Stuff life this is still useful and readable:
const invert = f => (...a) => !f(...a);
const is = prop => value => obj => obj.hasOwnProperty(prop) && obj[prop] == value;
isCat = is('type')('cat')
So you can do things like animals.filter(invert(isCat))
But eventually people are going to use combinators in js...
f=>((x)=>f((v)=>x(x)(v)))((x)=>f((v)=>x(x)(v))) -
otakbeku2977yHappened every time, last year. Now I never use dat again. Moved to python and their silly indent
var { name: x } = person
Day 1 : that's some good ES6 code man, I'm so 2017
Day 5 : Oh yeah I think it works, dont really remember
Day 17 : WTF is that ? Is that even Javascript ?
undefined
refactoring
javascript
es6
wtf?