toan-myGitHub w1-node-ecosystem-1#29
toan-myGitHub w1-node-ecosystem-1#29toan-myGitHub wants to merge 1 commit intopce-uw-jscript400:masterfrom
Conversation
bwreid
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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" | ||
| }, |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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.
No description provided.