It seems that I need to create N amount of garbage by design.
This does not work, the const has already been defined:
```javascript
try {
new Proxy({},{});
const ES6_PROXY = true;
} catch(o_O) {
const ES6_PROXY = false;
}
```
This does not work neither
```javascript
try {
new Proxy({},{});
var ES6_PROXY = true;
} catch(o_O) {
var ES6_PROXY = false;
}
const ES6_PROXY = false;
// var 'ES6_PROXY' has already been declared
```
neither does the following
```javascript
try {
new Proxy({},{});
let ES6_PROXY = true;
} catch(o_O) {
let ES6_PROXY = false;
}
// Illegal let declaration outside extended mode
```
As summary, there is no way to feature detect and define a const in the
same scope, a closure without the possibility to define such constant as
well is mandatory.
```javascript
const ES6_PROXY = function(){
try {
new Proxy({},{});
return true;
} catch(o_O) {
return false;
}
}();
```
This is not such a huge deal, but it does not feel/look right with bigger
amount of features detection and a growing adoption of constants.
Thoughts?
Cheers
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss