Our site uses cookies. Learn more about their purpose and change of settings in a browser If you are using the site, you give you consent to use cookies, according to current browser settings. Got it

Promise bug

  • Language JavaScript
Fix promise broken chain. `app.js` contains a first attempt to solve this, but not all tests are passing.

Promise bug


You should fix this promise broken chain.


We've got a function called app, that accepts 3 callbacks. Each callback returns a promise. First, it should invoke callback A. If A resolves it, the app should invoke B with the value resolved by A on param. If A rejects it, the error should be handled by C and B should not be invoked. In this case the app should return the result of C invocation. If both A and B resolve, the app should return the value resolved by B.

app.js contains the first attempt to solve this, but not all tests are passing. Please fix that.


To install dependencies from package.json:

npm install

To run tests in development mode:

mocha --watch

To run jshint and tests:

npm test

To run jshint and tests with human readable output:

grunt --force

Start this test

I agree to subscription in accordance with the terms of service.
Go to the top and begin