Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

twhat is a js promise

const promise1 = new Promise((resolve, reject) => {
  setTimeout(() => {
    resolve('foo');
  }, 300);
});

promise1.then((value) => {
  console.log(value);
  // expected output: "foo"
});

console.log(promise1);
// expected output: [object Promise]
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #twhat #js #promise
ADD COMMENT
Topic
Name
6+3 =