Netflix interview question

Write a contains() function in JavaScript.

Interview Answer

Anonymous

Mar 14, 2012

function contains(a, b) { while ((a != b) && (b != null)) { b = b.getParent(); } return (a == b); }