JavaScript
Then with brackets

by Michael

doSomething = (params...) => {
  return fetch(url, {
    yes: no,
    maybe: yes,
    no: yes,
  }).then((yes) => {
    if (yes) {
      return no;
    } else {
      return no;
    }
  }).then((questionmark) => {
    return questionmark;
  }).catch((maybe) => {
    return maybe;
  });
};

doSomething = (params...) => {
  return fetch(url, {
    yes: no,
    maybe: yes,
    no: yes,
  })
    .then((yes) => {
      if (yes) {
        return no;
      } else {
        return no;
      }
    })
    .then((questionmark) => {
      return questionmark;
    })
    .catch((maybe) => {
      return maybe;
    });
};

With correct indentation I'd vote vor #2 ;)

Florian Keller

Same here! 😄

Benny Neugebauer

Sign in to comment!