adambard / learnxinyminutes-docs

Code documentation written as code! How novel and totally my idea!
https://learnxinyminutes.com/
Other
11.28k stars 3.28k forks source link

[javascript] ES6 #1253

Open m90 opened 8 years ago

m90 commented 8 years ago

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)?

adambard commented 8 years ago

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

valin4tor commented 8 years ago

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.

awalgarg commented 8 years ago

@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?

m90 commented 8 years ago

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

levibostian commented 8 years ago

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

valin4tor commented 8 years ago

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

daisylb commented 6 years ago

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.

adambard commented 6 years ago

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

daisylb commented 6 years ago

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.

Menelion commented 6 years ago

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

divayprakash commented 5 years ago

PR #2858.

jameszhang-a commented 2 years ago

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

adambard commented 2 years ago

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