Defuse the bombs!
JavaScript
Bomb.diffuse( 42 );
for (let i = 0; i < 5; i++) Bomb.diffuse( i );
Bomb.diffuse( global.BombKey );
diffuseTheBomb = () => true;
Bomb.diffuse();
Bomb.diffuse("3.14159");
Bomb.diffuse(new Date().setYear(2016));
Bomb.diffuse(Object.freeze({ key: 43 }));
const hack = {
valueOf: () => {
if (!this.called) {
this.called = true;
return 0;
} else { return 20 }
}
}
Bomb.diffuse(hack);
Math.random = function() {
return {
valueOf: () => {
if (!this.called) {
this.called = true;
return 0.5;
} else { return 1 }
}
}
}
Bomb.diffuse(42);
Array.prototype.valueOf = function() {
return this.reduce((acc, val) => acc + val);
}
Bomb.diffuse(new Buffer("yes").toString("base64"));
- javascript (Private)
- 3-kyu (Private)
- codewars (Private)
- answer (Private)