Skip to content

Instantly share code, notes, and snippets.

Created March 31, 2016 00:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/49715c82e834f8e2c184d35a821ec468 to your computer and use it in GitHub Desktop.
Save anonymous/49715c82e834f8e2c184d35a821ec468 to your computer and use it in GitHub Desktop.
function assert(b, i) {
if (!b) {
throw new Error("Bad")
}
}
function foo(arg) {
let o;
if (arg) {
o = {};
} else {
o = function() { }
}
return typeof o;
}
noInline(foo);
let o1 = {};
let o2 = function() { }
for (let i = 0; i < 10000; i++) {
let bool = !!(i % 2);
let result = foo(bool);
if (bool)
assert(result === "object");
else
assert(result === "function");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment