fac-14 / MDEM-TODO

MDEM's week 2 to do list project
GNU General Public License v3.0
0 stars 1 forks source link

ES6 arrow functions in logic.js? #31

Open martingaston opened 6 years ago

martingaston commented 6 years ago

honesty box: I am not great at knowing the difference between ES5/ES6 :blush:

line 37 of logic.js is return todos.filter(todo => todo.id !== idToDelete); - are arrow functions new to ES6, and as this is read by the browser I think we're sticking to ES5?

Perhaps replace with an anonymous function?

return todos.filter(function(item) {
return item.id !== idToDelete
});

please do ignore if i'm wrong tho :crying_cat_face:

GiuliaTeggi commented 6 years ago

Yes arrow functions are a wonderful feature of ES6. Even if most browsers today support them - except for IE - when using ES6 you should really use a compiler (such as Babel) to ensure that all of your code can be read by all browsers with no problems. Anyway don't worry about this now, you will be introduced to Babel in the second part of FAC - for now try to stick to ES5 :wink:

sima-qian commented 6 years ago

A bit of hypocrisy here - we also have an arrow function in our logic.js because they just look so damn hot :bowtie: