Chapter 2: arrow functions

This commit is contained in:
Beth Griggs
2020-05-21 12:45:14 +01:00
parent 85007a6879
commit d8d40e12e5
6 changed files with 14 additions and 21 deletions
@@ -1,5 +0,0 @@
first(args, function () {
second(args, function () {
third(args, function () {});
});
});
@@ -3,7 +3,7 @@ const path = require("path");
const filepath = path.join(process.cwd(), "hello.txt");
fs.readFile(filepath, "utf8", function (err, contents) {
fs.readFile(filepath, "utf8", (err, contents) => {
if (err) {
return console.log(err);
}
@@ -3,14 +3,14 @@ const path = require("path");
const filepath = path.join(process.cwd(), "hello.txt");
fs.readFile(filepath, "utf8", function (err, contents) {
fs.readFile(filepath, "utf8", (err, contents) => {
if (err) {
return console.log(err);
}
console.log("File Contents:", contents);
const upperContents = contents.toUpperCase();
fs.writeFile(filepath, upperContents, function (err) {
fs.writeFile(filepath, upperContents, (err) => {
if (err) throw err;
console.log("File updated.");
});
@@ -3,7 +3,7 @@ const path = require("path");
const filepath = path.join(process.cwd(), "hello.txt");
fs.readFile(filepath, "utf8", function (err, contents) {
fs.readFile(filepath, "utf8", (err, contents) => {
if (err) {
return console.log(err);
}
@@ -3,7 +3,7 @@ const path = require("path");
const filepath = path.join(process.cwd(), "hello.txt");
fs.readFile(filepath, "utf8", function (err, contents) {
fs.readFile(filepath, "utf8", (err, contents) => {
if (err) {
return console.log(err);
}