#ES5+ (Javascript)#
ES5+ (Javascript)
EDIT: Removed explicit variable declaration, as otherwise it was hoisted and a non-configurable window.x property was created (unless run line by line in the REPL console).
Explanation:
Makes advantage of the fact that any globally scoped variable is also a property of the window object, and redefines "window.x" property to have a constant value of 1.
Clean
for(x=0; x<8; x+=1) console.log(x);
Augmented
Object.defineProperty(window,'x',{value:1});
for(x=0; x<8; x+=1) console.log(x);
NOTE: To make this work in Node.js, just replace "window" with "global" (tested in Node.js 6.8.0)