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

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
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