In this post, I will cover some new features in ES6.
It will be helpful if you are new to ES6 or learning front-end frameworks.
Topics I’m gonna c...
For further actions, you may consider blocking this person and/or reporting abuse
Thanks for this article! For
get set
I think it's more customary to useget name()
andset name()
instead ofget getName() set setName()
, but it's essentially the same.Thank you. I updated :) :)
I'd like to point to the case of your
get Name
andset Name
. Usually you keep those methods in lowercase to simulate an actual property so that who uses your class/object sees them as normal property retrieval/assignment.@eerk example is perfect, since it is also good practice to name the actual property with the same name of the getter/setter methods prepended by an underscore
Nice post and good examples, thanks! Although I don't understand why so many examples use let over const. I think it's better to use const wherever you can. Is there a reason to consider the opposite?
Because
let
will never throw an error and is seen as the successor ofvar
, whileconst
is more restrictive.You are right though, as long as you write ES6 always use
const
unless you see you explicitly need to change the variable reference, like for counters and booleansThanks for news,good post.
In two of your examples I think you reference the wrong variable.
let SumElements = (arr) => {
console.log(arr); // [10, 20, 40, 60, 90]
let sum = 0;
for (let element of arr) {
sum += arr;
}
console.log(sum); // 220.
}
SumElements([10, 20, 40, 60, 90]);
As well as in the following example of for of loops.
Thank you. I updated :) :)
Overall nice post and clear explanations, however, arrow functions are not just a new syntax for writing a function in Javascript. Regular functions still exist, and both of them behave differently in a matter of ways, most importantly in how they affect the scope and how
this
is bound in each of them. So more explanation should be done on that part. But still, nice post!The case of the function examples is wrong,
newOne
andoldOne
should start lowercase if you are trying to show good clean examples.Thank you. I updated :) :)
Nice, you might like: jsfeatures.in and git.io/es6-paws
This is awesome dude, thanks for taking the time to make it!
Thnx You have the gift of explain the things easily... More post how this pls
Thanks, @david . It means a lot to me. :)
Thanks for the explanations, it cleared up some things in ES6 for me.
I really appreciate your post. Didn't know about this. I love to see this big improvement and it's really useful. Now I want to learn more
Thank you. It means a lot to me :) :)
Thanks for this. I have also put together some useful examples for using rest & spread in es6.
smartdevnow.com/2017/06/02/es6-res...
Genious
Great explanation. Thanks!
Nice post and thank you! The second expmple of 'Sets' is wrong in my editor, the keyword 'New' should be 'new'?
Conclusion: the whole article is self-explanatory.