let doSmth = () => {
return new Promise((resolve, reject) => {
if (Math.random() > 0.5) {
resolve('doSmth success');
}
else
{
reject('doSmth Fail');
}
});
}
let doSmthElse = async () => {
return await new Promise((resolve, reject) => {
if (Math.random() > 0.5) {
resolve('doSmthElseSuccess')
}
else
{
reject('doSmthElseFail');
}
})
}
// -- CHAIN
(async () => {
try {
let resSmth = await doSmth();
console.log('res = ' + resSmth);
let resSmthElse = await doSmthElse();
console.log('resSmthElse = ' + resSmthElse);
} catch (e) {
console.log(e);
}
})();
-
MY PROJECTS
-
Recent Posts
- WepPackDevServer
- Git. Rev-Parse. Getting latest commit
- Git.Log
- Git.Revert
- Git. Clean
- Git. Reset
- Git. Amend
- Git. Making commits history clean in the branch
- Git. How do i squash commits?
- Delphi.Masterpiece.Connections and ini settings
- Delphi. Difference between virtual and non virtual constructor.
- Js.WebPack.TryoutsWithTwoApps
- Delphi.Masterpiece.What is the log path in masterpiece platform ?
- TpLink. Forward Port
- Delphi. ConstantArrays
- Delphi. Enum and strings
- Git.Add putty to System Variables
- How to install openssl cert on local machine and how to combine them?
- Delphi.ManagedTypes.Const
- JS. Send PostRequest from Browser Console
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)
- Регулярные выражения
- Тестирование приложений