You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Arman,
I have the chance to quickly review this exercise, and in general is all great. Just some remarks:
I would advice you that you take your time to name your variables and functions with a good and descriptive name. It’s a best practice to use camelCase (as you have done) and actually tell what the function is doing by giving the function name a verb as prefix. So instead of myFunction, what about something like checkResponses or something like that, a bit more informative :)
That function doesn't need a parameter, so you can remove it. You have put a "R" parameter but you never use it (see you invocation of the function myFunction();, you don't need anything. So remove it from the definition as well.
Review your if else statements. They work (well done!!), but you have some unnecessary code there. Some documentation here. In this case with just 2 possibilities (either is true or false), you don't need to use and else if (that is useful when having more than 2 scenarios). But you just have 2: this or that. So a super simple if and else pattern is all you need. With that pattern, the second else block will execute if the first if condition is false, so you don't need to write the condition again making it the opposite. With a simple else, is already defined.
I'll try to explain myself better. You have done something similar to this:
if(condition === true) {
// Run this code
} else if (condition !==true) {
// Run this instead
}
It works, and that's great. But let's try to be more efficient with our code, avoiding redundant things. The block below is exactly the same as this one:
if(condition === true) {
// Run this code
} else {
// Run this instead
}
I hope I'm explaining myself clear enough 🙏🏻, and sorry if not! Let me know if you understand all this, and try to improve your code in that sense. If this is not clear enough, let me know and we can discuss it more via Slack of jitsy until is clear :)
Well done, Arman!! 💪🏻
The text was updated successfully, but these errors were encountered:
I appreciate your assistance; your feedback has greatly helped me in understanding what I am doing in my codes.
I've made all of the suggested changes. It has now been updated with the new ones. I hope that works.
Hi Arman,
I have the chance to quickly review this exercise, and in general is all great. Just some remarks:
myFunction
, what about something likecheckResponses
or something like that, a bit more informative :)myFunction();
, you don't need anything. So remove it from the definition as well.if else
statements. They work (well done!!), but you have some unnecessary code there. Some documentation here. In this case with just 2 possibilities (either is true or false), you don't need to use andelse if
(that is useful when having more than 2 scenarios). But you just have 2: this or that. So a super simpleif
andelse
pattern is all you need. With that pattern, the secondelse
block will execute if the firstif
condition is false, so you don't need to write the condition again making it the opposite. With a simpleelse
, is already defined.I'll try to explain myself better. You have done something similar to this:
It works, and that's great. But let's try to be more efficient with our code, avoiding redundant things. The block below is exactly the same as this one:
I hope I'm explaining myself clear enough 🙏🏻, and sorry if not! Let me know if you understand all this, and try to improve your code in that sense. If this is not clear enough, let me know and we can discuss it more via Slack of jitsy until is clear :)
Well done, Arman!! 💪🏻
The text was updated successfully, but these errors were encountered: