Hi all,
As I work on a plan for a new set of MDN code guidelines, one issue that has come up is our policy on use of modern JavaScript features. So far we have avoided using ES6+ features as much as possible, as we felt that a lot of web developers don’t use them yet, so they will just serve to make examples less understandable, raising the barrier for comprehension unnecessarily.
Our feelings on this have never been officially recorded anywhere, except for the Interactive example JS guidelines. I intend to change that by giving an official recommendation in the guidelines.
But I also wanted to make the case that we move with the times, and start using ES6+ features on MDN examples. I think since we decided our existing policy, things have moved on, and developers are now comfortable with more modern JS features than they used to be.
I think our new recommendation should be something like:
"For general usage*, we are fine with common ES6 features being used in MDN examples, such as arrow functions, promises, let/const, template literals, and spread syntax. For newer features like async/await, trailing commas on argument lists, maps, etc., we’d prefer you not to use those unless strictly necessary, and if you do use them, include explanation in your example to say what they are doing, with a link to appropriate reference material.
* as in, general example writing. Reference pages covering specific modern ES features obviously need to use the features they are documenting!"
What do people feel about this?