Skip to content

fieldsr_w1_hw#18

Open
ryancfields wants to merge 2 commits intopce-uw-jscript400:masterfrom
JSArchive:master
Open

fieldsr_w1_hw#18
ryancfields wants to merge 2 commits intopce-uw-jscript400:masterfrom
JSArchive:master

Conversation

@ryancfields
Copy link

No description provided.

* **Question:** What is the purpose of the `.gitignore` file? What is the significance of a "dot-file?"

* **Your Answer:**
* **Your Answer:** Files you do not want tracked by Git.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And, more broadly, a "dot-file" is typically a hidden file.

* **Question:** From the command line, how can you run this file?

* **Your Answer:**
* **Your Answer:** npm index.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll actually be node index.js. node is the program that allows to run JavaScript on our machine. npm is a package manager and gives us access to packages and scripts, among other things.

* **Question:** What will you enter on the command line to run that script?

* **Your Answer:**
* **Your Answer:** node index.js start
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be npm start.

* **Question:** The same pattern will not work to try and run this script. How can you successfully get this script to run?

* **Your Answer:**
* **Your Answer:** node index.js my-file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be npm run my-file.

* **Question:** What are some ways you can solve this problem?

* **Your Answer:**
* **Your Answer:** You can use an array to export more than one value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An array or an object. Objects are more typical.

* **Question:** Do you need to use a `./` to require the package? Why or why not?

* **Your Answer:**
* **Your Answer:** ./ lets node know to look in the same realitive path it is running inside of.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, and in this case we are not looking for a relative file path but instead an installed module. In that case, we'll look inside of node_modules/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants