let doSmth = () => {
return new Promise((resolve, reject) => {
if (Math.random() > 0.5) {
resolve('doSmth success');
}
else
{
reject('doSmthFail');
}
})
}
let doSmthElse = () => {
return new Promise((resolve, reject) => {
if (Math.random() > 0.5) {
resolve('doSmthElseSuccess')
}
else
{
reject('doSmthElseFail');
}
})
}
doSmth()
.then((result) => {
console.log(result);
return doSmthElse();
})
.then((result) => console.log(result))
.catch(e => console.log(e));
-
MY PROJECTS
-
Recent Posts
- Js.Practice.ToDoList
- CSS.Grid
- Nginx. How to return json file?
- Js.React.AddEventsOnRender
- Js.React.Handling Event in Functional Components
- Js.React.ComponentState
- Js.React.Functional and class style
- Js.React.How react renders?
- JS.EventLoop
- JS.Promise.AsyncAwaitChain
- Js.Promise.AsyncAwait
- Js. Chain of promises
- Algo.Leetcode.111. Minimum Depth of Binary Tree
- Algo. Leetcode. 104. Maximum Depth of Binary Tree
- Algo. Leetcode. 100. Same Tree
- Js.InterviewTasks.CalcNumbersInFunctions
- Delphi. Const for managed types
- SQL.Group by
- GitExtensions.SSH.PuttyClient
- Delphi. What is difference to TProcedure, TMethod = procedure of object and TAnonMethod = reference to procedure ?
Categories
- Aptana
- Azure
- C#
- DataSnap
- DBExpress
- Delphi
- Delphi и сети
- Delphi. Язык программирования
- ExtJS
- FastReport
- FireDAC
- FireMonkey
- GIT
- ICS
- IDE
- IIS
- Indy
- InnoSetup
- javascript
- jQuery
- JSON
- LiveBindings
- MSHTML
- MySQL
- PHP
- REST
- Ribbons
- SMS
- SQL инструкции
- SVN
- TRichView
- UniGui
- WebBroker
- WinAPI
- Windows
- Алгоритмы
- Без рубрики
- Деревья
- Ищу ответ
- Компонентостроение
- Мои компоненты
- Начальный уровень
- Обработка исключений
- Парсинг
- Потоки(Threads)
- Регулярные выражения
- Тестирование приложений