Skip to content

Instantly share code, notes, and snippets.

@xavi-
Created October 19, 2010 00:15
Show Gist options
  • Save xavi-/633341 to your computer and use it in GitHub Desktop.
Save xavi-/633341 to your computer and use it in GitHub Desktop.
Interview gist -- Can candidate write code?

Instructions

  • Solve all problems using JavaScript

Problems

  1. Write a function that returns an array with the first n powers of 2. Call it twoPow.

  2. Use twoPow and Array.prototype.reduce to the sum of the first 10 powers of 2.

  3. Describe this call signature:

    say("Hello")("World");  // An alert displaying, "Hello World" appears
    
  4. Implement the say function from question 3.

  5. Simplify the following code:

    if(foo !== '' || foo !== null || typeof foo !== 'undefined') {
        alert(foo);
    }
    
  6. Write a sum function that takes any number of parameters.

@Sannis
Copy link

Sannis commented Oct 20, 2010

Stupid question: At what round of the interview you ask such questions?

@xavi-
Copy link
Author

xavi- commented Oct 20, 2010

This for an entry level position. For a more senior position, I'm using this gist: http://gist.github.com/633087

@Sannis
Copy link

Sannis commented Oct 20, 2010

Yes' I'd looked at it. Classical questions, I think.
It refreshed my memory, thanks. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment