- Familiarity with JavaScript as a language.
- Familiarity with JavaScript in the browser environment.
By the end of this, developers should be able to:
- Reference the Node API documentation for using JavaScript outside the browser.
- Reference the MDN JavaScript documentation for JavaScript language features.
- Write a Node script using the File System API.
- Fork and clone this repository.
- Install dependencies with
npm install
.
- JavaScript: a language specified by ECMA and implemented independently
- Browser: an environment for running JavaScript (among other things)
- Node: an environment for running JavaScript outside the browser
Somewhat valid equations:
Browser = JavaScript + Browser API + (other things)
Node = JavaScript + CLI/Server API
How are the two environments similar? How do they differ?
Take a few minutes to read the following API documentation for the Node File System module.
While you're reading, imagine how you'd use each function. Write some example code in your notebook. Try to explain what each function does in your own words, including what sorts of arguments it takes and each argument's type.
If you finish early, look for other interesting functions in the File System module.
fs.readdir(path, callback)
fs.readdirSync(path)
fs.readFile(file[, options], callback)
fs.writeFile(file, data[, options], callback)
Are these methods JavaScript, node, or browser?
Math.random
fs.readFile
http.ClientRequest
document.ready
new Promise
"Hello, World!" with the Node file system API.
Randomize the lines in a file.
How do you shuffle an array?
Run your code using: node bin/randomizer.js example.txt
Write a node script that takes a JSON string and parses into an object.
Input: "{ names: ["first last", "jon smith", "chris payne"]" }
Output:
{ names: {
first: "last",
jon: "smith",
chris: "payne" }
}
- Docs | Node.js
- JavaScript | MDN
- Node Courses from CodeSchool
- NodeSchool
- Fisher-Yates shuffle, aka Knuth shuffle.
- All content is licensed under a CCBYNCSA 4.0 license.
- All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact legal@ga.co.