Impala stotting, a behavior that may signal to predators that a pursuit would be wasted

The Peacock’s Feathers and “++a+a++”

How the same hypothesis is applied in ethology and economics

Joan Xie
Published in
1 min readAug 10, 2015

--

If it is costly for a male peacock to show off his beautiful tail feathers, and he does, then he must be competent enough to afford the cost.

That is the handicap principle. The same principle works for programmer interviews.

++a+a++

No actual project would utilize such hard-to-remember and useless things as shown above, but such code often appears in exams and interviews.

Because they are costly for one to learn.

Only those competent enough would bother learn the fancy skills. And such questions readily distinguish the more competent interviewees from the less-so ones.

Here is the bonus point.

In JavaScript, if the variable a is correctly initialized, after the code runs, the variable a will increase by 2, and the code itself evaluates to 2 * (the original value of a) + 2.

--

--