Alanis Chua2,830 Points
function instead of document.write
why using the print() and call the function later on instead of only document.write
Hi Alanis, the print() function is more efficient because when calling the function you're setting the innerHTML property of a certain 'div' in the DOM (based on its class or id) to the string you'll normally just write out on the document object(document.write()). And since you wrap it all in a function that means its reusable, whenever you want to print out something on the web page, you just call the function passing in an argument(string, array, variable etc) to print it out.