New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Binary Search Trees project: levelOrder requiremement is not clear #27880
Comments
Thanks for opening this issue, @nguyenlekhtn. I've noticed this step is a common source of confusion amongst learners. However, this does feel a bit strange as the default behaviour is very different in nature to when a callback is provided. Since this (and the next step with the different traversal orders) is effectively like I believe this would make it more intuitive and also be more in line with how you'd expect such a method to work anyway. @TheOdinProject/ds-a thoughts? |
Just adding on to the above, my suggestion regarding throwing an error if no callback is passed in (for Given that Ruby works a bit differently with things like returning Enumerators if no block's provided instead of throwing an error, I'm wondering then how best to approach the Ruby version. @TheOdinProject/ruby thoughts on this? Not familiar enough if something like always returning an array, block or not, would be the most ideal. I know that for the JS version, it would make most sense to never return something from it and just throw if no callback provided. |
Checks
Describe your suggestion
The requirement asks to return an array of values if no callback is provided. But what should the function return if a callback is provided? Should it return an array of values too? Or it should return nothing if callback is provided?
My suggestion is that the function should always return an array of values no matter callback is provided or not.
Path
Ruby / Rails, Node / JS
Lesson Url
https://www.theodinproject.com/lessons/javascript-binary-search-trees
(Optional) Discord Name
haru => {haru:}
The text was updated successfully, but these errors were encountered: