Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Brandon Jacobi
4,702 PointsI don't get this JavaScript Function?
What is the point of this function? Im confused on what It exactly does.
function print(message) {
document.write(message);
}
1 Answer
Justin Horner
Treehouse Guest TeacherHello Brandon,
That function will take the value passed in as "message" and print it to the document.
For example, if I passed "Hello, Brandon" to the function like this.
print('Hello, Brandon');
document.write(message) will add 'Hello, Brandon' to the document associated with the JavaScript.
I hope this helps.
Brandon Jacobi
4,702 PointsOh okay I get it now. Thanks!
Justin Horner
Treehouse Guest TeacherYou're welcome! Happy coding :)
Jesus Mendoza
23,289 PointsJesus Mendoza
23,289 PointsIt just change the content of the document and writes the message passed as parameter to your function.