another way to handle the print function

Similar to your work in #8, this gives the user the option of printing using the repl, the browser's console, both, or any function.