learnxinyminutes-docs icon indicating copy to clipboard operation
learnxinyminutes-docs copied to clipboard

[javascript] ES6

Open m90 opened this issue 10 years ago • 13 comments

There needs to be ES6. Anyone working on that already?

I'm not too sure though if this should be treated as a separate language or go as an addendum to JavaScript (will probably break the runnable example rule)?

m90 avatar Sep 28 '15 18:09 m90

Yeah, it should definitely be separate (as with python/python3)

adambard avatar Sep 30 '15 02:09 adambard

Just started working on this; you can have a look here.

edit: might take a few days as I've got school, gonna try to write about the key parts of this.

vtenfys avatar Oct 04 '15 16:10 vtenfys

@adambard I think the python/python3 case won't be good here since Python 3 breaks backwards compatibility quite enormously, while ES6 is 100% backwards compatible with ES5 (leave for some minor edge cases rarely ever encountered IRL which nobody cares about).

Although I 100% agree that ES6 is one major update (http://i.imgur.com/X53WgY6.png), it'd still not be that much of a big addition to the current JS doc at learnxiny because of the conciseness that learnxiny docs aim for. For instance, most of the new additions to Array.prototype and String.prototype wouldn't make for much place in the doc just like Array.prototype.forEach and ilk aren't documented in the current ES5 doc.

Addition of the new syntax (arrow functions, destructuring etc) and exotic objects (like generators and proxies) should do, IMHO.

Thoughts?

awalgarg avatar Oct 16 '15 13:10 awalgarg

Agree with @awalGarg here. DRY. A concise addition to the existing ES5 one should be better than duplicating thing like simple math.

m90 avatar Oct 17 '15 12:10 m90

@awalGarg explains it really well. I agree keeping it all in 1 doc.

levibostian avatar Oct 18 '15 17:10 levibostian

Sorry for taking so long, finally got round to doing it

vtenfys avatar Oct 28 '15 09:10 vtenfys

There's two good PRs adding ES2015 already, and my intention is to do a bit of editing and merge the best of both; I'd forgotten about this but now that I've been reminded I'll do it this weekend.

Originally when those PRs came up I agreed with @adambard that ES2015 deserved its own article, but now that all modern browsers support nearly all of it I think it's appropriate to merge it into the original, indicating which parts are ES2015-only as appropriate.

daisylb avatar Sep 13 '17 03:09 daisylb

Yes, I agree with this -- we can start adding features to the JS article. I guess I'll try to dredge up one of the old PRs and see if they still merge

adambard avatar Sep 13 '17 05:09 adambard

I'm going to edit the best bits of both of them into the current document manually this weekend; given how long it's been that's probably a better option than unleashing git merge onto it.

I also wanted to go through which features were and weren't mentioned; IIRC there were a few things in each of them that I didn't feel warranted a mention in LXIYM. I'll post the updated version as a PR to get feedback once it's done.

daisylb avatar Sep 14 '17 01:09 daisylb

@adambrenecki, thanks a lot! I'm still cleaning here a bit, that's why I'm raising those old issues :).

Menelion avatar Sep 14 '17 19:09 Menelion

PR #2858.

divayprakash avatar Dec 26 '18 09:12 divayprakash

Can I work to just replace all of the var's with let and const. Since, to my knowledge, in most cases today, using var is bad practice. Given that the majority of the guide uses var, it might lead beginners down some headaches. There's also no mention of classes for OOP.

I also don't see the point in separating ES6 and <ES6 anymore. I propose the whole document be re-written in modern standards. I can get started on that if someone on the core team agrees. @adambard

jameszhang-a avatar Sep 21 '21 05:09 jameszhang-a

@jameszhang-a I agree with this, it's time.

adambard avatar Sep 21 '21 06:09 adambard