I started to use ES6 fat arrow function notation and I really like it. But I am a little bit confused about it context. As far as I know, keyword this inside fat arrow function refers to context where the function is currently running. I wanted to do some simple jQuery iteration like:
$('ul#mylist > li').each(() => {
$(this).addClass('some-class-name');
});
But obviously this piece of code not working. How do I refer, inside fat arrow function, to current "LI" element in this specific code?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…