Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js promise

const prom = new Promise((resolve, reject) => {
  resolve('Yay!');
});
 
const handleSuccess = (resolvedValue) => {
  console.log(resolvedValue);
};
 
prom.then(handleSuccess); // Prints: 'Yay!'
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #js #promise
ADD COMMENT
Topic
Name
9+7 =