Ad
  • Default User Avatar

    You might know this buy string literals would make your last function much easier to read.

    return ('From binary: INPUT is OUTPUT'.replace('INPUT', input).replace('OUTPUT', parseBinary(input)));

    becomes:

    return `From binary: ${input} is ${parseBinary(input)}`;

  • Default User Avatar
  • Custom User Avatar

    That's a nice catch. I will look into this :-)

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    It is still possible to get Function constructor:

    function Function() {}
    console.log(Object.constructor.constructor); // Function constructor!
    

    Why it works: At the time of writing, the code forbidding the Function constructor looks like this:

    Function.prototype.constructor = undefined;
    

    And the Function is a variable reference which can be shadowed by local function declarations. (This works because in JavaScript, function declarations are executed before normal statements. Using a variable here will error on accessing undefined.prototype.)

    Thus, putting that statement on the top of your solution will leave the real Function constructor untouched.

    To forbid these hacks, a method of obtaining the Function constructor without using any variables is required, such as (function () {}).constructor.