0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

javaScript async test

Posted at

自分用の備忘録

async function asyncTest(num) {
    console.log("asyncTestメソッド開始");
    if ( num === 1 ) {
        console.log("渡された引数は 1 だったぜ");
        return "1";
    } else {
        console.log("渡された引数は 1 じゃなかったぜ");
        throw new Error('エラーを返すぜ');
    }
}

asyncTest("s")
    .then( val => {
        console.log("メソッド成功したぜ")
        console.log(val);
    } )
    .catch( err => {
        console.log("メソッド失敗したぜ(エラーを受け取ったぜ)")
        console.log(err);
    });
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?