Why not: responseFromServer === true?

With responseFromServer === true is not working but with just responseFromServer it is. Why?

Hello there,

This is what the tests are doing:

      /if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g

In general, if you change code you are told not to, you will get unexpected results.

Otherwise, typically, a server will not respond with true - it will respond with the data, and hopefully some metadata like the responseCode.

That is, you would not want:

if (responseFromServer === true) {...

Because, it is more likely responseFromServer will be an object literal.

Hope this clarifies

1 Like