JavaScript Node.js Basics Create a Command Line Weather Application Retrieving Data - Solution

Brian Patterson
Brian Patterson
19,584 Points

difference 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

Sorry, it's vice versa, replacing empty strings ( ' ' ) with underscores ( '_')

We 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
Brian Patterson
19,584 Points

What do you mean “replacing the underscores with empty strings.”?