Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
var successJob = new Promise(function(resolve) {
    console.log('success');
    resolve(true);
}).then(onSuccess('successJob'), onError('successJob')).then(always('successJob'));
var failureJob = new Promise(function(resolve, reject) {
    console.log('failure');
    reject();
}).then(onSuccess('failureJob'), onError('failureJob')).then(always('failureJob'));
function always(p) {
  return function() {console.log(p + ' always');};
}
function onSuccess(p) {
 return function() {console.log(p + ' onSuccess');};
}
function onError(p) {
  return function() {console.log(p + ' onError');};
}
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
OrKoNpro
0viewers