thank you for your article.
I really like it.
I also like how you increase the difficulty in relation to your examples.
I would like to highlight an error and some thoughts on the content.
Please don't have any hard feelings regarding my comment.
I really like your article and that's why my engagement is so strong :).
Example 2
"We’ll also handle the case where the exponent is 0, since any number raised to 0 is always itself (2^0 = 2)."
This is mathematically incorrect because 2^0 = 1. I assume this is just an unintentional error because, as far as I can tell, the code is correct.
Example 5
I found it easier to understand by making a mind map which can be found at the following link:
Boxes as mindmap
I'm not sure how long this mind map link will be active, so I'm really sorry if the link dies.
I was wondering what happens if there is no key in the boxes? I think both functions won't return anything, keeping the user uninformed :D. I understand that these are just oversimplified examples, but it made me chuckle a bit considering the surprised reaction of a developer who forgot, putting a key in a box :D.
Thank you Akin! I appreciate the thoughtful feedback. You're absolutely right about the error in my explanation in Example 2. I've now corrected this part:
We’ll also handle the case where the exponent is 0, since any number raised to 0 is always itself (2^0 = 2).
to now say:
We’ll also handle the case where the exponent is 0, since any number raised to 0 is always 1 (2^0 = 1).
You're right that the code was correct, just the written explanation was incorrect. Thanks again for that!
For your second question about Example 5, that's correct that the findKeyInBox method will return undefined if the key isn't found. So if a developer were using this method in some larger application, they'd know that there was no key if the function returned undefined, and they'd know the ID of the box the key was in if there was a key.
Hello Tyler Hawkins,
thank you for your article.
I really like it.
I also like how you increase the difficulty in relation to your examples.
I would like to highlight an error and some thoughts on the content.
Please don't have any hard feelings regarding my comment.
I really like your article and that's why my engagement is so strong :).
Example 2
"We’ll also handle the case where the exponent is 0, since any number raised to 0 is always itself (2^0 = 2)."
This is mathematically incorrect because 2^0 = 1. I assume this is just an unintentional error because, as far as I can tell, the code is correct.
Example 5
I found it easier to understand by making a mind map which can be found at the following link:
Boxes as mindmap
I'm not sure how long this mind map link will be active, so I'm really sorry if the link dies.
I was wondering what happens if there is no key in the boxes? I think both functions won't return anything, keeping the user uninformed :D. I understand that these are just oversimplified examples, but it made me chuckle a bit considering the surprised reaction of a developer who forgot, putting a key in a box :D.
Thank you Akin! I appreciate the thoughtful feedback. You're absolutely right about the error in my explanation in Example 2. I've now corrected this part:
to now say:
You're right that the code was correct, just the written explanation was incorrect. Thanks again for that!
For your second question about Example 5, that's correct that the
findKeyInBoxmethod will returnundefinedif the key isn't found. So if a developer were using this method in some larger application, they'd know that there was no key if the function returnedundefined, and they'd know the ID of the box the key was in if there was a key.In the GitHub repo I wrote some test cases, so those should help highlight the behavior: github.com/thawkin3/recursion-vs-l...