I've been looking at some example code in order to build a practice Nodejs application and I've noticed that the callback functions vary in how they are called:e.g. (see the first line of both examples): Artist.findById(req.params.id, (err, foundArtist) => { if(err){ console.log(err) } else { res.render("artists/edit", {artist: foundArtist}); } }); vs Artist.findById(req.params.id, function(err, foundArtist){ if(err){ console.log(err) } else { res.render("artists/edit", {artist: foundArtist}); } }); Are there any differences in how these work/best practices to follow?I wasn't sure how to google this, so thought I'd ask it here.
Submitted July 23, 2019 at 02:18PM by Heck_
No comments:
Post a Comment