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.

JavaScript Node.js Basics 2017 Building a Command Line Application Capturing Command Line Arguments

users.forEach(getProfile); not working for me

When I start app.js nothing processes. https://w.trhou.se/0yswtgpkx5

3 Answers

Sharina Jones
PLUS
Sharina Jones
Courses Plus Student 18,771 Points

I'm on my phone so I can't check, but I think you need to pass the individual users into the function.

Something like

users.forEach(user => { getProfile (user)})

@Sharina Jones

That would work if he was using the values within the scope of the JavaScript file, but Quentin needed to use the arguments from the terminal and thus use the command node app.js 'chalkers' 'quintinriley' 'davemcfarland'

I'm to use the process object instead of passing in the individual users

Quintin Riley The process object and it's argv method checks the arguments entered on the terminal. So if wanted to get the profiles of "chalkers", "quintinriley", and "davemcfarland", you would need to enter the following command in the terminal: node app.js 'chalkers' 'quintinriley' 'davemcfarland'

The command above will provide you with the necessary arguments. The reason you weren't seeing anything "processed" is because you weren't adding the additional usernames to the command.

Hope this helps, Rich