Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="promises">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
/* I can change the global variable here*/
someGlobalVar = 'globalVar__INITAL';
let p = fetch('https://httpbin.org/get')
  .then((res, err) => {
    someGlobalVar = 'globalvar__NEW';
    return res.status
    
  }, err => console.error(err))
p.then(status => console.log(`in .then() ${someGlobalVar}`))
let innerReturnFunction = (res) => {
    console.log(res)
}
let getVersions = (uri) => {
    var something  = 'one'
      return fetch('https://httpbin.org/get').then(function (res, somethingelse, hi) {
    console.log(res, somethingelse, hi);
    return innerReturnFunction.call(this, 'hi', something, res)
  }.bind(this, 'hi', something));
}
getVersions()
Output

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

Dismiss x
public
Bin info
arturoromerotcspro
0viewers