Skip to content

toan-myGitHub w1-node-ecosystem-1#29

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

toan-myGitHub w1-node-ecosystem-1#29
toan-myGitHub wants to merge 1 commit intopce-uw-jscript400:masterfrom
toan-myGitHub:master

Conversation

@toan-myGitHub
Copy link

No description provided.

Copy link
Contributor

@bwreid bwreid left a comment

Choose a reason for hiding this comment

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

Please take a little more time to read through the questions to make sure you understand what is being asked. Or, ask for help! I'm always happy to clarify if something is confusing.


npm init -y
-y stands for yes
generate an empty npm project without going through an interactive process
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not necessarily that it's empty, it's that it sets all the default values.

---
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
Copy link
Contributor

Choose a reason for hiding this comment

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

This answer doesn't describe what is happening. When you run npm test, the value of test gets run. So, in this case, we get a message printed to the screen and then our program exits.

* **Your Answer:**

---
my-file is not one of npm command
Copy link
Contributor

Choose a reason for hiding this comment

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

Correct! But then, how would you run it? In this case, you would type: npm run my-file

the output is Hello world

type in JavaScript
String, Number, Boolean, Undefined, Null, Object, Array, Function
Copy link
Contributor

Choose a reason for hiding this comment

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

The question above is asking what the types are of module.exports and require specifically. module.exports is an Object whereas require() is a Function.

---
Hello, Node!
Toan Bui
C:\source\Summer2019\w1-node-ecosystem
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't describe what path is. path is a module built-in to Node that we can use to access information about the file system.

* **Your Answer:**

---
const moment = require('./node_modules/moment/moment.js')
Copy link
Contributor

Choose a reason for hiding this comment

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

While you can do this, you do not need to. You only need to do the following:

const moment = require('moment')

This will find the package in the node_modules/ folder by default.

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