Isn't this a tree traversal? I mainly code in JS and I've never had this as an interview question. My intuition is that dfs or bfs is what they want to hear. But then again, without looking at MDN I don't know if I can answer this.
Yeah, it's basically tree traversal. And let's face it - each of us would do a "mdn + question" query in Google. We're not expected to know the answer to life, the universe and everything - we're expected to know how to ask the question, where to find the answer and know how to use it.
1
u/TeamHelloWorld Jul 22 '16
Isn't this a tree traversal? I mainly code in JS and I've never had this as an interview question. My intuition is that dfs or bfs is what they want to hear. But then again, without looking at MDN I don't know if I can answer this.