Tuesday 27 August 2019

How to rewrite tutorial code using Async?

How do I write the it section of NetNinja's tutorial to use Async?Here is Netninja'svideo. Here is Netninja'sgithub.Here is Netninja's original code:githubHere is my attempt:it('Updates the name of a record', async function(){ await MarioChar.findOneAndUpdate({name: 'Mario'}, {name: 'Luigi'}); await function () { MarioChar.findOne({_id: char._id}); }.function(result){ console.log(`Result is ${result}`) }; }); Result: My console.logs don't show and I get an error at function(result).

Submitted August 28, 2019 at 12:39AM by normandantzig

No comments:

Post a Comment