Skip to content

confusion around the arrow function callback in readFile (step 2.5) #15

@jsms90

Description

@jsms90

Confusion around the callback in arrow function in

readFile(filePath, (error, file) => {
  // code here
})

Add to mentor walkthrough notes:

  • Clarify that readFile takes 2 arguments. The second argument is a callback function. We are defining that function & using the error-first pattern.
  • Re-write this line using ES5 syntax i.e. readFile(filePath, function(error, file) {}), which students are more familiar with. Comment out the ES5 version and leave it directly above the ES6 version for comparison.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions