Skip to content

W1 Lesson Notes#5

Open
Alexlied wants to merge 1 commit intopce-uw-jscript400:masterfrom
Alexlied:master
Open

W1 Lesson Notes#5
Alexlied wants to merge 1 commit intopce-uw-jscript400:masterfrom
Alexlied:master

Conversation

@Alexlied
Copy link

No description provided.

* **Question:** What is the difference between forking and cloning a repository as opposed to just cloning a repository?

* **Your Answer:**
* **Your Answer:** Forking is a request to clone and registers under your username.
Copy link
Contributor

Choose a reason for hiding this comment

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

Not quite. Forking makes a copy of the project on your GitHub account. When you fork a repository, nothing is happening locally. When you clone a repository, you're building a connection between a folder on your local machine and what's on GitHub through a remote. When you do both, you get a copy of the project (with all the same code) on both your GitHub account and on your local machine.

* **Question:** What does `npm init` do? How does the `-y` flag modify that command?

* **Your Answer:**
* **Your Answer:** Created a package.json file with information about the author, repo, etc.
Copy link
Contributor

Choose a reason for hiding this comment

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

Additionally, the -y flag responds "Yes" to all questions that would've been asked by npm init. Just try npm init out on its own to see what would happen without the -y flag.

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

* **Your Answer:**
* **Your Answer:** It tells the repo what files to ignore.
Copy link
Contributor

Choose a reason for hiding this comment

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

And, a "dot-file" is a hidden file, typically one that deals with configuration.

* **Question:** What is `module.exports` and what is its _type_ in JavaScript? What is `require` and what is its _type_ in JavaScript?

* **Your Answer:**
* **Your Answer:** It is a way of connecting files together. It is a function.
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs more detail.

  • module.exports is an object and allows us to export from one file to others.
  • require is a function and pulls in whatever was exported in another file. If nothing was exported, it imports an object.

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

* **Your Answer:**
* **Your Answer:** Put it in an array {a, b}
Copy link
Contributor

Choose a reason for hiding this comment

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

The {} syntax is for objects!

* **Question:** What is `path` and where does it come from?

* **Your Answer:**
* **Your Answer:** It is the path of the package location and comes from node
Copy link
Contributor

Choose a reason for hiding this comment

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

Strictly speaking, path is a package that is imported by default from Node. path has methods that will tell us interesting information like the file path.

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

* **Your Answer:**
* **Your Answer:** No, you use require('moment')
Copy link
Contributor

Choose a reason for hiding this comment

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

Why or why not?

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