Skip to content

Instantly share code, notes, and snippets.

@r37r0m0d3l
Forked from ThomasG77/playground-tweet.js
Created July 30, 2017 18:44
Show Gist options
  • Save r37r0m0d3l/3de7ead0093c8e1527e94ed3ff09f6e7 to your computer and use it in GitHub Desktop.
Save r37r0m0d3l/3de7ead0093c8e1527e94ed3ff09f6e7 to your computer and use it in GitHub Desktop.
Dirty Javascript reproduction of https://twitter.com/jplur_/status/891358168688754688
// Dirty overload the native function
var parseInt = function(arg1) {
if (arg1 === "Infinity") {
return NaN;
}
if (arg1 === "Infinity+1") {
return "Infinity+1";
}
if (arg1 === "1+1+1") {
return "3?";
}
if (arg1 === "") {
return "stop it";
}
if (arg1 === parseInt) {
console.error("Getting really tired of your bullshit");
}
}
// Then do the magic like at https://twitter.com/jplur_/status/891358168688754688
parseInt("Infinity") // NaN
parseInt("Infinity+1") // "Infinity+1"
parseInt("1+1+1") // 3?
parseInt([]+[]+[]) // "stop it"
parseInt(parseInt) // "Getting real tired of your bullshit.."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment