News for hackers. Stuff that matters.
Re:You Can't JavaScript Under Pressure by downtowncanada on Thursday October 03, 2013 @12:01PM (#6489862)
if(typeof i[p] === typeof 3){//it's an int

  sum += i[p];
}else if(typeof i[p] === typeof [3]){//it's an array

  recursion(i[p]);
}

pretty simple no?

Re:You Can't JavaScript Under Pressure by cs02rm0 on Thursday October 03, 2013 @12:15PM (#6489964)
That would've been simpler, but I seemed to get away with typeof(i[p]) === "object" and typeof(i[p]) === 1*typeof(i[p]) to test if it was an int.

I dread to think what obscure code I've left behind.

Re:You Can't JavaScript Under Pressure by chrisrhoden on Thursday October 03, 2013 @06:22PM (#6492554)
no, in this case the first will match on all numbers and the second will match on all objects.

You should learn a little more about JS before you call this simple.