ClassesBaseline · Widely available
Classes are an object-oriented syntax for JavaScript prototypes.
Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Mar 8, 2016. Widely available since Sep 8, 2018.
Browser support
DesktopChrome
1–41Not supported
42+Supportedsince Apr 14, 2015
Current: 155Edge
12–12Not supported
13+Supportedsince Nov 12, 2015
Current: 154Firefox
1–44Not supported
45+Supportedsince Mar 8, 2016
Current: 157Safari
1–8Not supported
9+Supportedsince Sep 30, 2015
Current: 27MobileChrome Android
18–41Not supported
42+Supportedsince Apr 15, 2015
Current: 155Firefox Android
4–44Not supported
45+Supportedsince Mar 8, 2016
Current: 157Safari iOS
1–8Not supported
9+Supportedsince Sep 16, 2015
Current: 27How to use
This feature is Baseline widely available — use it freely, no fallback needed.
Example
Full syntax and examples are on MDN: Classes.
Feature detection
JS · check before using
// Syntax can't be tested with an if-statement — an unsupported
// browser fails to parse the whole script. Either transpile for older
// targets (e.g. Babel/TypeScript/esbuild), or probe in isolation:
let supported = true;
try {
new Function("/* code that uses the syntax */");
} catch {
supported = false;
}This is a language syntax feature.
Documentation (MDN)
Specification
Usage share
Sub-features
Support for each part of the feature (14). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| javascript.classes | 42 | 13 | 45 | 9 | 42 | 45 | 9 |
| javascript.classes.constructor | 42 | 13 | 45 | 9 | 42 | 45 | 9 |
| javascript.classes.extends | 42 | 13 | 45 | 9 | 42 | 45 | 9 |
| javascript.classes.private_class_fields | 74 | 79 | 90 | 14.1 | 74 | 90 | 14.5 |
| javascript.classes.private_class_fields_in | 91 | 91 | 90 | 15 | 91 | 90 | 15 |
| javascript.classes.private_class_methods | 84 | 84 | 90 | 15 | 84 | 90 | 15 |
| javascript.classes.public_class_fields | 72 | 79 | 69 | 16 | 72 | 79 | 16 |
| javascript.classes.static | 42 | 13 | 45 | 9 | 42 | 45 | 9 |
| javascript.classes.static.class_fields | 72 | 79 | 75 | 14.1 | 72 | 79 | 14.5 |
| javascript.classes.static.initialization_blocks | 94 | 94 | 93 | 16.4 | 94 | 93 | 16.4 |
| class | 42 | 13 | 45 | 7 | 42 | 45 | 7 |
| new_target | 46 | 13 | 41 | 11 | 46 | 41 | 11 |
| super | 42 | 13 | 45 | 7 | 42 | 45 | 7 |
| class | 42 | 13 | 45 | 10.1 | 42 | 45 | 10.3 |