showing results for - "what is a promise"
Simon
18 Jan 2018
1new Promise( (res, rej) => {
2  setTimeout(() => res(1), 1000);
3}).then( (res) => {
4  console.log(res); // 1
5  return res*2
6}).then( (res) => {
7  console.log(res); // 2
8});
9
Aliyah
08 May 2018
1var promise = new Promise(function(resolve, reject) {
2  // do some long running async thing…
3  
4  if (/* everything turned out fine */) {
5    resolve("Stuff worked!");
6  }
7  else {
8    reject(Error("It broke"));
9  }
10});
11
12//usage
13promise.then(
14  function(result) { /* handle a successful result */ },
15  function(error) { /* handle an error */ }
16);
Felipe
19 Oct 2017
1A promise is an object that may produce a single value some time in the future: 
2either a resolved value, or a reason that it’s not resolved 
Lorri
27 Jul 2018
1// Promise is a special type of object that helps you work with asynchronous operations.
2// Many functions will return a promise to you in situations where the value cannot be retrieved immediately.
3
4const userCount = getUserCount();
5console.log(userCount); // Promise {<pending>}
6
7// In this case, getUserCount is the function that returns a Promise. If we try to immediately display the value of the userCount variable, we get something like Promise {<pending>}.
8// This will happen because there is no data yet and we need to wait for it.
Leni
17 Mar 2019
1import isPromise from 'is-promise';
2
3isPromise(Promise.resolve());//=>true
4isPromise({then:function () {...}});//=>true
5isPromise(null);//=>false
6isPromise({});//=>false
7isPromise({then: true})//=>false
Juana
14 Jan 2021
1let promise = new Promise(function(resolve, reject){
2  try{
3  	resolve("works"); //if works
4  } catch(err){
5    reject(err); //doesn't work
6  }
7}).then(alert, console.log); // if doesn't work, then console.log it, if it does, then alert "works"
queries leading to this page
javasscript promise syntaxpromise js examplepromise js methodswhy should we use promise in javascripti promisehow to then in jspromises definitionjs promise nedirprom jsjava script promisesjavascript promises mdntwhat is a js promise 25 3c 25 promisewhat is api promise 3fwhat is a promise js 3fhow can you use the promise apihjavadcript promiseswhat is promise javascriptpromises in javascript functionwhat is promises in jspromise mdnpromises js mdnwhat is promises on javascript 3fpromise jpromise js meaningwhat are promissesjs promise alpromises methodjs what is promisehow to make promise javascriptjs create a promisepromise object jsmdn promisewhat is a promise 28 29 3fnode js promiseswhat is javascript promisesjavascript info promisespromises in functions jsreturn new promise 28 28resolve 2creject 29 3d 3e 7bjavascript promisrpromisejs promises javascript inforeturn from promise in jspromise in javascriptjavascript handle promisenode js thenjs promise utilin a promise what does when dohow to use this in promise jspromisses jsjavascrippromiseswhats a new promisepromises javascrioton promise meaningwhat are promises in javascript used forjs promises overviewpromise javascript w3schools promise function in javascript examplepromise js then 28 29promise 28 28 29 29what is js promisepromise using javascript javascript when did promisesjs what is promisepromises javascript explainedjavascript 5bobject promise 5dwhat is promisesjavascript promise examplejs promises in a browserwhat is a js promisewhat is promises in javascriptcreate a new promises then jspromise javascriptpromisesspromises methods in javascriptpromise statement javascripthow to use promise in javascritpwhat are promises in jsjs make promisepromise javascript w3javascript 2bpromisepromis javascriptnew promisepromise examplepromise 28es6 29 3bjavascript promise 28function 29promices in java scriptwhat is a promise in javsscriptcreate a promise in javascriptexplain promises how to run a promise javascriptuse of javascript promisesnew promise examplepromise 7b 7dpromise javascriptnodejs thenjs 2c promisesjavascript promises with jsonunderstanding javascript promisejs promise w3schoolscreate a promise in jspromises example promise 28 29 js js promise definitionsyntax of promise in javascriptpromise api javascript infojkavascript promise javascript promisthen function javascriptjavascript promise functionpromises js 5cpromise jaascripthjavascript promiseall about promise in javascriptjs promisesjs promises exampleis promisesan es6javascript promiseswhy you need promise in javascriptwhat is javascript promisewhat is the use of promisepromise in javascript defjavascript promise objectcountapi js example return a promisewhat 27s a promise javascriptporomise in javascriptjavascript promise documentationwhen to use javascript promisesjs promise apiwhat is promise in annodejs promiseswhat is promise in javascript simple explanationexample promise javascriptwhat are promises in javascript 3fcall promis jshow to make a promise javascriptpromises in javaacriptjs api promisewhat are javascript promises 3fwhen is promises requiredpromise 28 29 javascriptwhat are es6 promiseshow to write a promise 5bpromise 2c promise 2c promise 2c promise 5dwhat is promise and why do we use itjavascript with promisespromise syntax in jsobject resolved value reason its not resolved javawriting a promise javascript w3schools 3d new promise 28 29testing promises javascriptpromise apiwhat is a promise js then in jspromise jswhat is es6 promisespromise example javascriptpromises in javasciptpromiss java scripthow to we create a promisepjavascript promisesjs promiss functionwhat is promise is javascript then in javascriptjavascript promise apipromise definitionfunction promisea promise javascriptpromise function jspromisse jswhat is the need of promise in javascriptpromises in javascript javascritp promisespromise methods jspromises api javascriptpromissse javascrhow a promise workspromises avascriptpromises javascryptnew promise in javascriptpromises java script exmplejavascript promises w3schoolshow do you describe a promise 3fpromise api definitionwhat are methods of promisejs thenpromises node jsjavasc promiseswhy use promises in javascriptpromise javascript samplewhat 27s a promisepromesses jsjavascript understanding promisesjavasciprt promisejs promise funcitonjs promise defpromise java scriptwhat does it mean to promisejs new promisewhy promise is made jsjavascript promise valueuse promise jsdo you really need promise javascriptmethods of promises in javascriptuse of promises in javascriptjavascript promise nedirsyntax for promiseswhy need the promise javascript 5bobject promise 5d 22promises mdnwhat are promises in javascriptjavascript create promisepromises questions jsthen in jspromises injavascriptjavacript promisescreate global promise resolve laterwhat is a promise object in javascriptunderstanding promisewhat is a promise nodejspromise object javascriptpromises in javascriptpointwhat promisespromise function promise 28 29promise functonnjs es6 promisehow do promises work in jshow have promis function in jspromise in javascript syntaxobject promisepromise dom functionspromises 2b jshow to do stuff with promisewhat is then in javascriptnew promise 28 28resolve reject 29 then javscriptdone promise javascripthow to use then javascriptpromise object propertyjavascript using promiseswhy do we use promises in javascripjavascript httppromisepromises javascript w3schoolspromise methoddsthen jshow to write a promise jsall type of promises in javascriptjs promissjs promise examplejs promicespromiss js definitionwhat are the promises in jspromise syntax in javascriptdefinition of a promisewhat is promises in javascriotjavascript method with promisejs thenpromise function javascriptwhat a promise javascriptare promises es6what is concept of promise in javascript with examplejavascrupt promisespromise syntax javascriptpromise object in javascriptwhat is promise in javascript examplenew promise 28 29 javascripthow to use promise in jsmethod to handle promise in javascriptwhat are promises jsjavascript dojo promisespromise using jsjs promise codewhat is the purpose of promise in javascriptmake object promisejava script promisepromise al javascrippromises in jsvscriptjavvascript promiseshow to use promisescreating promises jsto promisewhy we use promises in javascriptnode js promisejs promosejavascript promises examplesnew promise funciton in jswhat is a promise 3f in jsjavascript 2cthenhow to define promise in node jspromise definationpromises javascript es6how to make a promisepromise jaspromises in java script promise onnew promise jsjavascript promise constructorpromises in javascri 5bt javascript promise etatpromise on function javascripthow to write promisepromise javascript infowhat promise in javascriptwhat is promise and how is it working 3f what it was designed for 3fpromises syntaxpromise a 3b 3bresolve reject promise examplepromises 5cimplement a promisejavascript promiepromises javascript api promiseswhy were promises createdwhat are the promiseswhen do we use promises in javascripthow to implement promise in javascripta promise isjavascript promissesnode js use promisedefine promise in var javascriptpromise nodejspromise syntax jses6 promises promisedefine promise jsjs promiseespromise thispromises explained javascript es6what is promise in js 3fpromises javascriptwhat is the use of promise simple explanation 5bpromise 2c promise 5djavascript promises tutorialpromisse in jspromises syntax in javascriptwhat is the purpose of a promise 3f in javascriptjavascript promise function examplethe promise programjavascrpt promiseswhere to use promises in javascriptwhat is it a promise in javascriptpromises javascript examplepromises in javascript mdnles promises javascriptjavascript api promisehow to use promise in javascriptpromiss jswhats is promisepromise function in javascriptwhy we use promise in javascriptwhen to use promise javascriptprogramming promisejavascript functions promisepromisenew promise 28function 28resolve 2c reject 29 7bwhat is promise in javascript with examplepromise meaningworking with promises javascripttutorial promises javascriptunderstand promise in javasciptpromises in js applicationsimple defination for promise in javascriptjavascrippt promiseexamples of js promisehow promise usedwhat is a promise javascriptpromise in apijavacsript promisespromises n jscreating my own promises jswhy do we use promises in javascript promises javascriptsample js promisewhere we use promises in jspromise method jswaht is a promiseconcept of promises in javascript then javascripthow to define promise in javascriptpromise in javasciptwhat si promise functions used to handle promises are namedpromises in javascritpromisse examplepromises jsjs promises explainedpromise javascript 5chow to create promise in javascriptjs promise functionjavascript promise specificationwhat is a promise in javascript 3fpromise in javascript example what is a promise javascript api examplehow to work with promises javascriptjavasccript promisespromise in scripthow to create a promisewhat is promise 3fpromise meanspromise en javascripthow to use promise what is a promise nodewhat is promises nodejspromise resolve 2c rejectpromises functionswhat are promises used for in javascript function promise javascriptprommise jswhat is prmoise 5bpromise 2c promise 5dwhat is promise in javascript syntaxpromises in java scriptjs what is a promise then jswhat is promise in functionwhat is a promise in javascript easy explanationhow to crerate promisejavascript pormisesjavescript promisesnew promise javascripthow to handle javascript promiseswhat is a promise es6whats promises jshandle promises jspromise example jspromise in js examplewhat does promise meansusing promise javascriptpromiseshow to create promisethen in javascriptpromises in jswhat is promise in javacsript and how to use themmake promise not resolve return value jspromises es6what is a javascript promiseusing promises javascriptjs using promiseswhat is a promisejswhats a promise javascriptwho invented javascript promises 3f then 28 29 in javascriptpromise npo javascriptwhat is the use of promises in javascript 3fpromises api mdnwhat is the use of promise in javascriptjs function promisehow to return promise in javascriptnew promise 28 28resolve reject 29 syntaxpromise in javascript methodspromise in function javascript what is promisesunderstand javascript promisespromise function definitionwhat is the meaning of promisewhat is a promise in programmingprogram with promises on jspromise innjspromise javascipthow to use then in jswhat 27s is js promises and what are the method 3fjavascirpt promisefunction promise in javascripthow to write promise in javascriptwhat is promise 28 29then method javascriptdefine promisejavascript got promisewhy do you use promises in javascriptpromise aahow do promises work in javascriptwhat parameter will defined the successful operation in promisefunction promises jsjavascript promises supportwhat are javascript promises then in javascript explaineda promise is ajavascript promise functionsthis promisejs promisepromise example in javascript promise javascript 5bobject promise 5d jsjavascript promise in promisepromises in es6 what does promise do in javascriptwhat does promise function dopromise 7b 7djavascript promise 3c 3eis promiseresolve reject promisepromises examples javascriptwhy use promisewhhat is a promise 3fjavascript object promisejavascript object promisescan you use promises in a constructor jspromise newuse promise in jspromise objectwhat is promise in node jspromises javascript definitionhow to make promise js functiones6 javascript promisesbasics of promiseswhat is promise in javascripthow promises work in javascriptmdn javascript promisejs promise 28 29resolve and reject in jswhat is a javascript promise 3fwhat is promise in jswhat is the use of promises in javascriptwhat does it mean to consume a promise jsthen javascriptjavascript promise meaningwhat is promises in javascript mdnsyntax for promises jsjs promise methodwhat are js promisewhat is javascript promise 3fwhat is a promise is jspromise syntaxwhen did javascript promises come out javascript what ois promise in jscan i use done with promise 3f jswhat is promise objectjavascript thenexplain javascript promisesnew promise 28function 28resolve reject 29use of promise in javascriptjavascript thenjs promise w3javascript then in javajavascript where to use promiseswhat is promise was designed for 3fwhy we use then in jspromises in javascript indetailspromises functionpromise definition javascriptfunction in promisewhat is promises in tha javascriptjs es6 promisescreate promise javascriptsample promise javascriptjavascript promise 28what are promises used for in jaswhat is promises in javacsriptpromises in es6javascript when to use promiseshow to write promises in javascriptpromies jspromises in jscwhat are promises 3fpromises in javascriptpromise value javascriptmade a promisewhat is use of promise 28 29 in javascriptwhat is a promise in javascriptpromise a what is api promisenode what is a promisewhat are promises javascript then 28 29 javascriptjavascript promisemake a promise in javascriptpromises javascirptthe promisewhat is the purpose of the js promise 3fjavascrit promiseswhen do we use the promise in javascripthow to use promises in javascriptjs promise a functionusing a promisejavascript es6 promisepromises in javacriptpromises promisesjavascript what does a promise returnpjavascript promisepromisesswifthow javascript promises workwhat is promise object in javascripta promise is a promisepromise resolve and reject exampledifferent types of promises 2cin javascriptwhat is it to promise somethingpromise function javascript definitionpromises javacriptin javascript 2c which of the following is not a promise methodwhat does a promise take inweb development promisespromises example in javascriptpromises javascript mdnwhat is a promise in web development 3fnew promisesjs promisejavascript info promiseshow does a js promise workwhat is promise used forwhat is promisejavascripts promise examplejavascript new promisehow to become a normal function into a promise in javascript 5bpromise 2c promise 2c promise 5dwhat is resolve and reject in promisewrite a promise in javascriptpromiss in javascriptpromise in javascritjavascrip promiseunderstanding promise in javascriptpromises explained javascriptusing then in javascripthow to write a promise function in jsjavascript how to make a function a promisepromiss jsjavascript what is promisepromise method in javascriptcreate promise jsimplement promisepromise api javascriptwhats a javascript promisewhat is the promises function in javascriptexplain promise in javascriptpromises in node jspromise methodjavaascript promiseexamples for promises jsjs promises implementation codewhat promisepromisess in jshow javascript promise workspromisse javascripthow does a promise work javascriptis promise can be a data type in jswhat is a promisepromises mdb javascripthow promise works in javascriptpromise js docspromises in js 3fpromise 3c 7b 7d 3epromise resolve rejecthow to use js promiseswhat are promisses in jsjavascript new promise functionjavascript make promisejavacript promisewhat are js promisesjs why use promisejavascript promise in a functionunderstanding promises in javascriptis promise a keyword in javascriptjavascript promise promise in javascriptobject promise javascriptmdn promisespromises hswhat is javascript promise 3fwhat is a promise in jswhat is a promise responsehandling promise in javascriptwhere to see promise in javascriptunderstanding promises in jswhat are promisespromise 2b jscreate promise in javascriptwhat do promises do in javascrtiptwhat does a promise return javascriptpromises in javascript es6promise explainedwhat are the promises in javascriptjs promises andhow internally promise works in javascriptthe promise object jswhat is a js promise 3fcreate a promisejavascript promise syntaxpromise is a promisecreating a new pormisewhat is use of promise in javascriptpromise es 3fwaht is promiseswhy to use promises in javascriptpromis in jspromise function in javascriptjs thenpromise a 3b 3bjava script promise functionuse promise in javascriptwhy are promises used in javascriptwhat is promise in javascript 3fjavascript promise w3js promise objectpromises in javasriptwhatis promise in javascriptin promisejavascript thenpromisses javascriptpromise 28 29function promisespromise dom jspromise library javascript whats a promise in javascriptja promisepromises inpromise javascript definitionwhat is the promise in javascript 3fwhy do we need a promisewhy do you need a promise 3f in jspromise 2bjavascriptpromises meaningadd this to promisework of promise in javascriptpromise promise 28 29 explained how to use a promise in javascriptjavascript es6 promisesjavascript future promisepromises injsjavscript promisepromise in jscreate a promoseuse promises javascriptvar promise 3d 5b 5dwrite promise in javascriptjavascript promises 5cjavascript understanding promise javascript promisepromise programnew promises javascriptvar promise 3d new promise 28function 28resolve reject 29 promise promise 28 29javasript promisesworking with promises in javascriptpromise 28 29 method in javascriptwhat is a promise in nodejspromise javascript exampledefinition of promise in javascript javasciprt promisespurpose of promisehow to rcreate a promise with afunctionwhat does promise mean in javascriptjavascript make a function a promisepromise 7b 27 27 7djavascrript promisethen javascriptwhat 27s promise in javascriptjs promisi made my promisepromises what arepromises js explaineduses of promise in jsnew promise js examplecan i use done with a promise javascripthow to work with promises jswhat does then do in javascriptpromise functionspromiwe data type jswhat is javascript promise objectpromise somein javascriptjavascript pormisepromese jsjavascript promise examplewhat is promises 2c use of promisesjavascript promisejavascript promise definitionwhat is the purpose of promises in nodejs promise what iswhat is promise in javascript definitionwhat is es6 promisea js promise ispromis jsjavascript promises explainedjavascript promiceswhatis promiseaesthetics promisespromise js functionjavascrpt promisepromises in ajvascriptjavascript 2b what is a promise 3f where and how would you use promisejs promise es6javascript promise methodsjs create promisewhat are promises and how do they help us write as javascriptpromise in javacriptmaking and using promises javascriptjs then functionif then jswhat is promise jsreturn new promise 28 28resolve reject 29new promise in jswhat is a promise