How could we write a function that traverses this tree, and logs each node to the console? Given what we’ve learned about binary trees, give it a shot with the following function.
Give it a try before looking at the following solution.
Let’s write a function that logs a node to the console only if it’s an integer.
Write a function onlyIntegersTree that only logs the integer values of a binary tree.
Give it a try before looking at the following solution.