taniarascia / comments

Comments
7 stars 0 forks source link

es6-syntax-and-feature-overview/ #50

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

ES6 Syntax and Feature Overview | Tania Rascia

ECMAScript 2015, also known as ES6, introduced many changes to JavaScript. Here is an overview of some of the most common features and…

https://www.taniarascia.com/es6-syntax-and-feature-overview/

TheAjinkya commented 3 years ago

Its much beneficial and to the point, Thanks!

clarkngo commented 3 years ago

Wow. This is very helpful.

chinabigcat commented 3 years ago

simple and powerful for me ,good good learn , day day up,好好学习 ,天天向上

SurajNaga commented 3 years ago

This is very helpful. Thanks a lot

aashiqahmed98 commented 3 years ago

Col stuff out there

ProKashif commented 3 years ago

Col stuff out there

0xAliRaza commented 3 years ago

Col stuff out there

2dareis2do commented 3 years ago

I like the way you can post comments here by logging into github?

I also like this concise intro to to es6 that provides excellent context by way of the es5 examples. I only came to read the bit on spread syntax and ended up reading the whole page.

Awesome site by the way. Obviously multi talented.

cdsaenz commented 3 years ago

When you're overwhelmed with information about new stuff (and not so new in fact) this is the kind of writing we need. Thanks a lot.

jlonuz commented 3 years ago

This was really helpfull! Thanks for explain very detallist. I really integrated the concepts and new features about ES6

rraj91091 commented 3 years ago

Useful reference page for ES6 syntax (thumb up)

NAVEEN-PERPAGA commented 3 years ago

Very Helpful Article about new ES6 Features I was looking for. Also MDN References are great addition to learn about these topics more deeply. Thanks Tania :)

pjopaul commented 2 years ago

Really appreciate for this summary article

miguelitomola commented 2 years ago

Great summary to have quick guide about ES6. Only one suggestion @taniarascia. The table of contents would be a bit more useful if items on it were clickable. Thank you for your work 🙂.

joquijada commented 2 years ago

Great and immensely helpful summary of changes between ES5 and ES6. One observation on the ES5 example on inheritance. If I copy/paste and run the full example, and then print out y.constructor it gives the below

ƒ Func(a, b) {
      this.a = a
      this.b = b
    }

Constructor should be ƒ Inheritance(a, b) {... because Inheritance was the constructor function use to create y. That can be fixed by executing this line:

Inheritance.prototype.constructor = Inheritance

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor

In the example above the exception will be shown since the constructor links to Parent. To avoid this, just assign the necessary constructor you are going to use.

Although, the MDN docs do go on to say that depending of the role of the constructor, in some cases this reassignment is not necessary, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor

Note: Manually updating or setting the constructor can lead to different and sometimes confusing consequences. To prevent this, just define the role of constructor in each specific case. In most cases, constructor is not used and reassignment of it is not necessary."), so I guess it depends

So I guess it all depends. Cheers!

Prateek-Tewari commented 2 years ago

Though i understand that it might be a typo, but here it should be "immutable" only in place of "not immutable". Please correct it as a lot of people take your blogs as reference.

taniarascia commented 2 years ago

@Prateek-Tewari My original statement is correct. const is not immutable. Example:

const list = []
list.push('something')
console.log(list) // ['something']
ajitirto commented 2 years ago

thank for informations

santhosh2907 commented 2 years ago

Your work simplifies for me!

Prateek-Tewari commented 2 years ago

@Prateek-Tewari My original statement is correct. const is not immutable. Example:

const list = []
list.push('something')
console.log(list) // ['something']

@taniarascia If you look into the definition provided by MDN as well, const holds an immutable reference to mutable values like an object. Hence,in my opinion,it can't be said with conviction what's written in your post. In case of a normal variable declared with const, we can not overwrite its value. For example : const name = "Tania" name = "Prateek" ( Not allowed,will throw error). But with objects,we can do that. Hence it has more to do with reference type data structures rather then const being not immutable. If it's not immutable,it should be able to change the value in all the cases and not exhibit different behaviour for different purposes like variables stored by value and variables stored by reference. Please read it again and clarify. I may be totally wrong but surely want to learn something here that I might be missing altogether. Thanks in advance. 🙂

ashikxcel commented 1 year ago

@Prateek-Tewari My original statement is correct. const is not immutable. Example:

const list = []
list.push('something')
console.log(list) // ['something']

@taniarascia If you look into the definition provided by MDN as well, const holds an immutable reference to mutable values like an object. Hence,in my opinion,it can't be said with conviction what's written in your post. In case of a normal variable declared with const, we can not overwrite its value. For example : const name = "Tania" name = "Prateek" ( Not allowed,will throw error). But with objects,we can do that. Hence it has more to do with reference type data structures rather then const being not immutable. If it's not immutable,it should be able to change the value in all the cases and not exhibit different behaviour for different purposes like variables stored by value and variables stored by reference. Please read it again and clarify. I may be totally wrong but surely want to learn something here that I might be missing altogether. Thanks in advance. 🙂

mutable and not immutable are not same, Thats why @taniarascia is not wrong

aliahmad01 commented 1 year ago

good its very helpful

Nikiaso commented 1 year ago

wow!

punitkatiyar commented 8 months ago

very very helpful