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 trialBrian Patterson
19,588 Pointsdifference between Node and Ajax.
I have two questions. What exactly does this mean?
const query = process.argv.slice(2).join("_").replace(' ', '_');
I get that we are starting from the second element in the array but I am lost as to the rest of it. Also, what's the difference between Node and Ajax? They are effectively doing the same thing with regards retrieving data from an API. So when is the right time to use which one?
2 Answers
Mira Hummingbird
15,937 PointsSorry, it's vice versa, replacing empty strings ( ' ' ) with underscores ( '_')
Mira Hummingbird
15,937 PointsWe are starting from the third element, not second, and then we are joining those elements on underscore, then replacing underscores with empty strings. Node is the runtime environment for JavaScript on the backend. It does not just retrieve data from API. We can do a lot of things with Node. AJAX if a front-end technology that allows us to retrieve data from some API without refreshing the page You write ajax request only in the front-end code.
Brian Patterson
19,588 PointsWhat do you mean βreplacing the underscores with empty strings.β?