3 replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
source | link

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`
source | link

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
1
source | link

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);
}