// THE WAY I SEE IT ON SO MANY JAVASCRIPT LESSONS IN AND OUT OF CODECADEMY
const plantNeedsWater = (day) => {
if (day === 'Wednesday') {
return true;
} else {
return false;
}
};
// **THE WAY I PREFER TO WRITE, COMING FROM C++.**
const plantNeedsWater = (day) =>
{
if(day === "Wednesday")
{
return true;
}
else
{
return false;
}
};
To be honest, the way I format seems so much easier to read, but again I see the top formatting so often when using Codecademy, even the instructor’s videos. Is the formatting way I use okay, or will I be discouraged from formatting this way at some point?
Correct me if I’m wrong, but Javascript is pretty lenient when it comes to formatting- so I think you just need to keep in mind the readability of your formatting.
For me, I prefer your way better (this coming from someone who specializes in Python).
It depends. When you start working on group projects or in a business environment, there may be coding style standards in place. Sometimes adhering to those standards will be assisted by and/or enforced with 3rd party tools that can be set to automatically reformat the code upon saving. such as Prettier, Beautify, ESLint, etc. etc.