JavaScript 开发者年度调查报告

2,463 阅读2分钟
原文链接: ponyfoo.com
本文已经翻译成中文《JavaScript 开发者年度调查报告》,欢迎参加「掘金翻译计划」,翻译优质的技术文章。

A whooping 97.4% of respondents write JavaScript for a web browser, while 37% of them write mobile web applications. Over 3000 of them – with 56.6% – also write server-side JavaScript. Among those who took the poll, 5.5% use JavaScript in some sort of embedded environment, such as Tessel or a Raspberry Pi.

A few participants replied they use JavaScript in some other places, notably in developing CLI and desktop applications. A few also mentioned Pebble and Apple TV. These fell in the Other category, with 2.2% of the votes.

An screenshot of the percentages for the first question

Where do you use JavaScript?

Unsurprisingly, 94.9% of voters use JavaScript at work. However, a large portion of the tallied – with 82.3% of the votes – also use it on side projects. Other responses included for teaching and learning, for fun, and for non-profits.

An screenshot of the percentages for the second question

How long have you been writing JavaScript?

Over 33% of the surveyed have been writing JavaScript code for over six years. Out of those who answered the poll, 5.2% started at most a year ago, 12.4% two years ago, and 15.1% three years ago. That makes it 32.7% people who started writing JavaScript in recent years, out of 5350 voters.

An screenshot of the percentages for the third question

Which compile-to-JavaScript languages do you use, if any?

A whooping 85% replied that they compile ES6 into ES5. Meanwhile 15% still use CoffeeScript, 15.2% use TypeScript, and a measly 1.1% reported they use Dart.

This was one of the questions I wish I’d approached more collaboratively, as it got 13.8% of “Other” responses. The vast majority of these answers were ClojureScript, elm, Flow, and JSX.

An screenshot of the percentages for the fourth question

What JavaScript stylistic choices do you prefer?

The vast majority of JavaScript developers who answered the poll seem to favor semicolons, at 79.9%. In contrast, 11% indicated they prefer not to use semicolons. When it comes to commas, 44.9% favor to place them after an expression, while 4.9% prefer to use comma-first syntax. When it comes to indentation, 65.5% prefer spaces, while 29.1% would rather use tabs.

An screenshot of the percentages for the fifth question

Which ES5 features do you use?

While 79.2% of respondents are on board with functional Array methods, and 76.3% indicated they use strict mode, Object.create sees a 30% adoption and getters and setters are only used by 28%.

An screenshot of the percentages for the sixth question

Which ES6 features do you use?

Notably, arrow functions are the most used ES6 feature among those who took the poll: 79.6%. Let and const together took 77.8% of the pollsters, and promises are also strong with 74.4% adoption. Unsurprisingly, only 4% of the respondents have played around with proxies. Only 13.1% of users indicated they’ve used symbols, while over 30% say they use iterators.

An screenshot of the percentages for the seventh question

Do you write tests?

While 21.7% never write any tests, most do write some tests, and 34.8% always write tests.

An screenshot of the percentages for the eighth question

Do you run Continuous Integration tests?

There’s a similar story with CI, although many more people don’t use a CI server – over 40%. Almost 60% of respondents use CI at least sometimes, of which 32% always run tests on a CI serve.

An screenshot of the percentages for the ninth question

How do you run tests?

59% like to run automated browser tests with PhantomJS or similar, and 51.3% also prefer to perform manual testing on a web browser. Automation in server-side tests amounts to 53.5% votes.

An screenshot of the percentages for the tenth question

What unit testing libraries do you use?

It would seem most voters prefer either Mocha or Jasmine to run their JavaScript tests, although Tape received a healthy 9.8% of the ballots.

An screenshot of the percentages for the eleventh question

It would seem like respondents are divided between ESLint and JSHint, but JSLint is surprisingly strong after all these years, at almost 30%.

An screenshot of the percentages for the 12th question

npm took over as the client-side dependency management system of choice, with 60% of the votes casted their way. Bower still holds 20% of the audience, and plain old