News for hackers. Stuff that matters.

japrescott

veryvery superb quiz! I like the way you mix questions with a tutorial, not just "HA, you suck, wrong", but really give detailed explanations, even when the correct answer is given. Maybe you can add some questions with strange return values or some "what happens if you modify the passed-in object within a function?";

function(){ var fn2=function(){} if (fn2()){ alert("nobody ever calls me"); } else{ alert("stop calling me!"); } } (no return value is a falsy value)

var data={a:"cow"}; function update(obj){ obj.a="fish"; } update(data); alert(data.a); //"fish"

vs.

var data="cow"; function update(str){ str="fish"; } update(data); alert(data); //"cow"

keep up the great work!

not true. boolean, strings, numbers (int, float) are passed by value, while Objects, Arrays and Functions are passed by reference!