Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Durdona Abdusamikovna
1,553 PointsI was reviewing learned materials about function
Hello there,
Here is a script
function message (parameter) {
document.write('Document message');
}
console.log(message ('passing argument'));
Why when I run this function document writes its message to the website but console doesn't.
3 Answers

Marcus Parsons
15,717 PointsHey Durdona,
The problem lies within your function. When you're passing in information to a function via a placeholder variable, you should use that variable to determine the output. So, you should change the string 'Document message' inside the function to the variable parameter
that way document.write() will receive the value passed into it in the form of the placeholder parameter
.
function message (parameter) {
document.write(parameter);
}
console.log(message('passing argument'));

Durdona Abdusamikovna
1,553 PointsAs I see all functions use parameter names within the function
function getRandomNumber(lower, upper){
var random = Math.floor(Math.random() * (upper - lower + 1)) + lower;
return random;
console.log(getRandomNumber (1, 6));
Thank you ! Didn't pay attention to time sorry

Marcus Parsons
15,717 PointsAbsolutely right! Nothing to be sorry about :) We all make mistakes, and so long as we learn from them, we keep on being awesome! haha :P

Durdona Abdusamikovna
1,553 PointsThank you :)

Marcus Parsons
15,717 PointsMy pleasure!