 <p>You need to use some semicolons. Otherwise the statements get blended.</p> <p>Why I think this is happening is that the function that calls <code>test</code> isn't getting called at all, but it's being passed to <code>test2</code> as the first argument.</p> <p>You can see that behavior here: <a href="https://jsfiddle.net/ssgagr3k/" rel="nofollow">https://jsfiddle.net/ssgagr3k/</a></p>