3 replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/ edited Apr 13 '17 at 12:39 Here is a solution for JavaScript that does not exploit the Infinity and -Infinity edge cases of floating-point addition. This works neither in Internet Explorer 8 and below nor in the opt-in ES5 strict mode. I would not call the with statement and getters particularly "advanced" features. with ({ $: 0, get x() {return 2 * this.$--;} }) { console.log(x == x+2); }  Edited to add: The above trick is also possible without using with and get, as noted by Andy EAndy E in http://codegolf.stackexchange.com/questions/2682/tips-for-golfing-in-javascript#4691Tips for golfing in JavaScript and also by jncratonjncraton on this page: var x = { $: 0, valueOf: function(){return 2 * x.$++;} }; console.log(x == x+2);  Here is a solution for JavaScript that does not exploit the Infinity and -Infinity edge cases of floating-point addition. This works neither in Internet Explorer 8 and below nor in the opt-in ES5 strict mode. I would not call the with statement and getters particularly "advanced" features. with ({ $: 0, get x() {return 2 * this.$--;} }) { console.log(x == x+2); }  Edited to add: The above trick is also possible without using with and get, as noted by Andy E in http://codegolf.stackexchange.com/questions/2682/tips-for-golfing-in-javascript#4691 and also by jncraton on this page: var x = { $: 0, valueOf: function(){return 2 * x.$++;} }; console.log(x == x+2);  Here is a solution for JavaScript that does not exploit the Infinity and -Infinity edge cases of floating-point addition. This works neither in Internet Explorer 8 and below nor in the opt-in ES5 strict mode. I would not call the with statement and getters particularly "advanced" features. with ({ $: 0, get x() {return 2 * this.$--;} }) { console.log(x == x+2); }  Edited to add: The above trick is also possible without using with and get, as noted by Andy E in Tips for golfing in JavaScript and also by jncraton on this page: var x = { $: 0, valueOf: function(){return 2 * x.$++;} }; console.log(x == x+2);  2 also possible without using with and get edited Jan 16 '13 at 21:52 PleaseStand 4,61422 gold badges1515 silver badges4343 bronze badges Here is a solution for JavaScript that does not exploit the Infinity and -Infinity edge cases of floating-point addition. This works neither in Internet Explorer 8 and below nor in the opt-in ES5 strict mode. I would not call the with statement and getters particularly "advanced" features. with ({ $: 0, get x() {return 2 * this.$--;} }) { console.log(x == x+2); }  Edited to add: The above trick is also possible without using with and get, as noted by Andy E in http://codegolf.stackexchange.com/questions/2682/tips-for-golfing-in-javascript#4691 and also by jncraton on this page: var x = { $: 0, valueOf: function(){return 2 * x.$++;} }; console.log(x == x+2);  Here is a solution for JavaScript that does not exploit the Infinity and -Infinity edge cases of floating-point addition. This works neither in Internet Explorer 8 and below nor in the opt-in ES5 strict mode. I would not call the with statement and getters particularly "advanced" features. with ({ $: 0, get x() {return 2 * this.$--;} }) { console.log(x == x+2); }  Here is a solution for JavaScript that does not exploit the Infinity and -Infinity edge cases of floating-point addition. This works neither in Internet Explorer 8 and below nor in the opt-in ES5 strict mode. I would not call the with statement and getters particularly "advanced" features. with ({ $: 0, get x() {return 2 * this.$--;} }) { console.log(x == x+2); }  Edited to add: The above trick is also possible without using with and get, as noted by Andy E in http://codegolf.stackexchange.com/questions/2682/tips-for-golfing-in-javascript#4691 and also by jncraton on this page: var x = { $: 0, valueOf: function(){return 2 * x.$++;} }; console.log(x == x+2);  Post Made Community Wiki by PleaseStand occurred Oct 21 '12 at 22:35 1 answered Sep 6 '12 at 11:47 PleaseStand 4,61422 gold badges1515 silver badges4343 bronze badges Here is a solution for JavaScript that does not exploit the Infinity and -Infinity edge cases of floating-point addition. This works neither in Internet Explorer 8 and below nor in the opt-in ES5 strict mode. I would not call the with statement and getters particularly "advanced" features. with ({ $: 0, get x() {return 2 * this.$--;} }) { console.log(x == x+2); }