Answers for "nodejs await"

16

async awiat

const data = async ()  => {
  const got = await fetch('https://jsonplaceholder.typicode.com/todos/1');
  
  console.log(await got.json())
}

data();
Posted by: Guest on July-24-2020
0

await in node js

// Normal Function
function add(a,b){
  return a + b;
}
// Async Function
async function add(a,b){
  return a + b;
}
Posted by: Guest on November-22-2020
0

async function someFunction()

async function someFunction() {
	console.log("someFunction");
 }
 
 Console.log("Start");
 someFunction();
 console.log("End");
Posted by: Guest on October-20-2020
0

await in node js

// server.js

function square(x) {
  return new Promise(resolve => {
    setTimeout(() => {
      resolve(Math.pow(x, 2));
    }, 2000);
  });
}

square(10).then(data => {
  console.log(data);
});
Posted by: Guest on November-22-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language