Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let b = async function() {
- throw "bad"
- }
- let a = async function() {
- try {
- return b();
- } catch (e) {
- console.log(123)
- }
- }
- let c = async function() {
- try {
- await a()
- } catch (e) {
- console.log("got it")
- }
- }
- c()
- function intervalFunc() {
- console.log('Cant stop me now!');
- }
- setInterval(intervalFunc, 1500);
- // output: got it and then cant stop me now
- let b = async function() {
- throw "bad"
- }
- let a = async function() {
- return await b();
- }
- let c = async function() {
- try {
- await a()
- } catch (e) {
- console.log("got it")
- }
- }
- c()
- function intervalFunc() {
- console.log('Cant stop me now!');
- }
- setInterval(intervalFunc, 1500);
- // outpub: got it and can't stop me now
- let b = async function() {
- throw "bad"
- }
- let a = async function() {
- try {
- return await b();
- } catch (e) {
- console.log("aaa catch")
- }
- }
- let c = async function() {
- try {
- await a()
- } catch (e) {
- console.log("got it")
- }
- }
- c()
- function intervalFunc() {
- console.log('Cant stop me now!');
- }
- setInterval(intervalFunc, 1500);
- // output: got it and can't stop me now
- let b = async function() {
- throw "bad"
- }
- let a = function() {
- try {
- return b();
- } catch (e) {
- console.log("aaa catch")
- }
- }
- let c = async function() {
- try {
- await a()
- } catch (e) {
- console.log("got it")
- }
- }
- c()
- function intervalFunc() {
- console.log('Cant stop me now!');
- }
- setInterval(intervalFunc, 1500);
- // output: got it and can't stop me now
Add Comment
Please, Sign In to add comment