Skip to content

Instantly share code, notes, and snippets.

Created June 3, 2016 13:09
Show Gist options
  • Save anonymous/39d6209649c8354e970f1b9405f5d3b7 to your computer and use it in GitHub Desktop.
Save anonymous/39d6209649c8354e970f1b9405f5d3b7 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Jun 3, 2016.
    47 changes: 47 additions & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>JS Bin</title>
    </head>
    <body>

    <script id="jsbin-javascript">
    'use strict';

    var promiseOne = Promise.reject();

    var promiseTwo = promiseOne.then(function () {
    console.log('then');
    });

    newPromise = promiseTwo['catch'](function () {
    console.log('catch');
    });

    promiseTwo.then(function () {
    console.log('itt legyel!');
    })['catch'](function () {
    console.log('ide nem, ugye?');
    });
    </script>



    <script id="jsbin-source-javascript" type="text/javascript">const promiseOne = Promise.reject();

    const promiseTwo = promiseOne.then(() => {
    console.log('then');
    });

    newPromise = promiseTwo.catch( () => {
    console.log('catch');
    })

    promiseTwo.then( () => {
    console.log('itt legyel!');
    }).catch( () => {
    console.log('ide nem, ugye?');
    })</script></body>
    </html>
    17 changes: 17 additions & 0 deletions jsbin.hogamorude.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    'use strict';

    var promiseOne = Promise.reject();

    var promiseTwo = promiseOne.then(function () {
    console.log('then');
    });

    newPromise = promiseTwo['catch'](function () {
    console.log('catch');
    });

    promiseTwo.then(function () {
    console.log('itt legyel!');
    })['catch'](function () {
    console.log('ide nem, ugye?');
    });