I analyzed several popular JavaScript repositories to see how much of the language is actually used in real projects.
Turns out the 80/20 rule is real — about 20–25% of language features cover 80–90% of the code.
I believe the data and interpretation are roughly correct — but I’m always open to feedback or alternative views.
Summary
Aggregate Analysis Summary
Dataset Overview:
- Total repositories analyzed: 55
- Total features in JavaScript catalog: 121
- Analysis covers: totals, presence, perKLOC metrics
Total Occurrences - Aggregate Results
- 80% of totals achieved with 17 features (14.0% of catalog)
- 90% of totals achieved with 30 features (24.8% of catalog)
- 95% of totals achieved with 42 features (34.7% of catalog)
File Presence - Aggregate Results
- 80% of presence achieved with 33 features (27.3% of catalog)
- 90% of presence achieved with 46 features (38.0% of catalog)
- 95% of presence achieved with 60 features (49.6% of catalog)
Per 1000 Lines of Code - Aggregate Results
- 80% of perKLOC achieved with 21 features (17.4% of catalog)
- 90% of perKLOC achieved with 34 features (28.1% of catalog)
- 95% of perKLOC achieved with 46 features (38.0% of catalog)
Top 7 Features
Rank | Feature | Count | % | Cumulative % |
---|---|---|---|---|
1 | binaryOp_/ | 1298069 | 20.08% | 20.08% |
2 | labels | 781944 | 12.09% | 32.17% |
3 | assignOp_= | 711165 | 11.00% | 43.17% |
4 | functions | 392279 | 6.07% | 49.24% |
5 | return | 265406 | 4.10% | 53.34% |
6 | if | 255167 | 3.95% | 57.29% |
7 | binaryOp_+ | 253173 | 3.92% | 61.21% |
Pareto Analysis
80% of usage comes from 17 features (14.0% of catalog):
binaryOp_/, labels, assignOp_=, functions, return, if, binaryOp_+, binaryOp_*, binaryOp_|, arrowFunctions, binaryOp_===, binaryOp_-, binaryOp_>>, logicalAND, binaryOp_<, ternary, awaitExpressions
90% of usage comes from 30 features (24.8% of catalog):
binaryOp_/, labels, assignOp_=, functions, return, if, binaryOp_+, binaryOp_*, binaryOp_|, arrowFunctions, binaryOp_===, binaryOp_-, binaryOp_>>, logicalAND, binaryOp_<, ternary, awaitExpressions, logicalOR, binaryOp_>, binaryOp_!==, exportDecls_named, importDecls, switchCases, jsxElements, updateOp_++, templateLiterals, forClassic, asyncFunctions, break, spreadElement
95% of usage comes from 42 features (34.7% of catalog):
binaryOp_/, labels, assignOp_=, functions, return, if, binaryOp_+, binaryOp_*, binaryOp_|, arrowFunctions, binaryOp_===, binaryOp_-, binaryOp_>>, logicalAND, binaryOp_<, ternary, awaitExpressions, logicalOR, binaryOp_>, binaryOp_!==, exportDecls_named, importDecls, switchCases, jsxElements, updateOp_++, templateLiterals, forClassic, asyncFunctions, break, spreadElement, classFields, classMethods, binaryOp_==, binaryOp_>>>, interpolatedTemplates, throw, classDecls, binaryOp_&, assignOp_+=, binaryOp_<<, binaryOp_%, updateOp_--
Catalog Usage Summary
Total features in JavaScript catalog: 121
Usage Threshold | Features Required | Catalog Percentage |
---|---|---|
80% | 17 | 14.0% |
90% | 30 | 24.8% |
95% | 42 | 34.7% |
Metrics explained
Totals How often each feature appears overall across all repositories. Shows which constructs dominate codebases globally (like
if
,=
, orfunction
).Presence In how many different files a feature is found. Reflects how widespread a construct is — some appear everywhere, others only in a few modules.
Per KLOC Density per 1000 lines of code. Normalizes for project size, letting you compare big and small repos fairly.
Each of these views shows a clear Pareto pattern:
A small core of features (around 20–30 out of 121) accounts for most of the language usage.
You can see the results and charts here:
Live reports
GitHub repo
Any comments or insights are welcome
Top comments (3)
On my coding style I near alway use const instead function. Also avoide using this expect the web component.
Thanks, Peter — that’s a great point!
I’ve just added the top-N most used features per repo, and it’s really interesting to see how it matches what you said: Express barely uses arrow functions, while Fastify is around 0.75, clearly preferring them.
It made me realize that coding styles can actually be inferred from these metrics — like your example of preferring
const
functions and avoidingthis
except in web components.Really appreciate the insight!
main disini berhadiah menarik dan bonus
JO777