Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • error-first callback in node.js?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 439
    Comment on it

    If user pass errors and data then we use Error-first callbacks .There are two argument in callbacks. first argument is always an error object which is for to check if something went wrong. and we use additional argument along with this parameter for passing data.

    Ex :-

    fs.readFile(filePath, function(err, data) {  
      if (err) {
        //handle the error
      }
      // use the data object
    });
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: