Adding an early return to avoid using else and additional nesting

I got the below comment from a developer:
" add an early return here to avoid using else and additional nesting". But I have a bit of difficulty with modifying.

Can you please let me know what exactly should I do in this case?
Thank you!

failOnStatusCode: false,

    }).then((res) => {

      // Assertion for one by one

      if (res.status != 200) {


      } else {






Source: JavaSript – Stack Overflow

November 10, 2021
Category : News
Tags: cypress | if-statement | javascript | node.js

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.