Hey Everyone quick question about proper practice, if the return for an if statement is a method call do I include the 'return' keyword?
For example this top code did not work with a return keyword on a method call but did work without the return keyword, but then in the 2nd piece of code the method call did work with the return keyword.
If you could please advise so I know which way is correct.
if (response.ok) {
return renderJsonResponse(response); // this did NOT work
};
if (response.ok) {
renderJsonResponse(response); // this did work
};
if (response.ok) {
return response.json(); // I therefore thought the 'return' would not work for this but it did
};
Aucun commentaire:
Enregistrer un commentaire