Update README for /** @const */

This commit is contained in:
Samuel Reed
2016-01-19 13:24:36 -06:00
parent 8b71c6559b
commit 918c17bd88

View File

@@ -395,6 +395,8 @@ separate file and include it into the build. For example you can have a
```javascript ```javascript
const DEBUG = false; const DEBUG = false;
const PRODUCTION = true; const PRODUCTION = true;
// Alternative for environments that don't support `const`
/** @const */ var STAGING = false;
// etc. // etc.
``` ```
@@ -404,8 +406,8 @@ and build your code like this:
UglifyJS will notice the constants and, since they cannot be altered, it UglifyJS will notice the constants and, since they cannot be altered, it
will evaluate references to them to the value itself and drop unreachable will evaluate references to them to the value itself and drop unreachable
code as usual. The possible downside of this approach is that the build code as usual. The build will contain the `const` declarations if you use
will contain the `const` declarations. them. If you are targeting < ES6 environments, use `/** @const */ var`.
<a name="codegen-options"></a> <a name="codegen-options"></a>
## Beautifier options ## Beautifier options