Technical interviews

Whenever I take an interview, ( usually javascript ), I ask them to write a function that takes an array of numbers and returns me an array with each element squared.

We end up spending 15 minutes on this questions, where I grill him on edge cases.

What happens if there is a dumb programmer who passes an object instead of array?

How do you even know if something is an array?

Oh, you put a check for '.length' property? What if the programmer is smart enough that he passes { length : 5 } as an input ?

Oh, you know map / reduce? implement the same problem using a reduce instead of a map. What 'sins' are you committing while doing the same?

You wrote a function Square(){} , how could you make it an anonymous function ? what will be the difference between this and writing const Square = () => {}, how would the compiler differentiate between the two, what difference in code behavior you can expect

and so on.

The questions needn't be tough to test the depth and creativity of the interviewee.

/r/ProgrammerHumor Thread Link - i.redd.it