Andrea Giammarchi (2013-12-19T20:03:30.000Z)
domenic at domenicdenicola.com (2014-01-06T13:46:15.195Z)
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?