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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Chris Mason](https://uploads.teamtreehouse.com/production/profile-photos/3176842/micro_screenshot_3.jpg)
Chris Mason
Full Stack JavaScript Techdegree Graduate 24,526 PointsWhat is being sliced off from the query?
I'm a bit unclear as to why the initial query is being sliced. If I just type in 90210 as the argument to app.js, what is it that is being sliced off the process.argv array?
const query = process.argv.slice(2).join("").replace('', '');
1 Answer
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsThe non-argument items are being removed.
The first item (index 0) is a reference to node itself, and the second one is a reference to app.js. By removing those, what remains are the arguments.
Chris Mason
Full Stack JavaScript Techdegree Graduate 24,526 PointsChris Mason
Full Stack JavaScript Techdegree Graduate 24,526 Pointsah thank you, I see. Is that the same for all Node apps then?
If I had a Node app that took two arguments (
node app.js argument1 argument2
)in the terminal command, would I want the statement to read as follows?:process.argv.slice(2, 3)
Steven Parker
230,688 PointsSteven Parker
230,688 PointsYou might, if you want to ignore a third (or more) arguments. A slice using a single argument of "2" would get all provided arguments (however many there were).