Remove Style Note
See original GitHub issuehttps://github.com/freeCodeCamp/freeCodeCamp/issues/45487
I see here that we are intentionally supporting confusing but technically correct syntax. In light of this, we should remove the note here
Note: There shouldn’t be any spaces between the array name and the square brackets, like array [0]. Although JavaScript is able to process this correctly, this may confuse other programmers reading your code.
myFunction (args);
myArray [0];
myString [0];
All of these are non-standard things that technically work but nobody actually does in practice. We should either go out of our way to support this sort of thing or not. If we are going out of our way to support this sort of thing, then there really isn’t much point of letting the users know that it’s unconventional syntax.
See also: https://github.com/freeCodeCamp/freeCodeCamp/issues/45570
Personally, I think it’s valuable to teach the learners how to write code that others expect to see so that it’s easier for them to get hired, but we really need to be consistent. We should either help them with conventions or not bother. If we aren’t doing anything after making the note, then it’s just visual noise and should be removed.
Issue Analytics
- State:
- Created a year ago
- Comments:9 (9 by maintainers)
Top GitHub Comments
Thanks for the thoughts @jeremylt & @bbsmooth
Here is what we should do:
For what it’s worth here’s what I think about formatting. In practice the likes of prettier have rendered manual formatting unnecessary and unhelpful - I don’t need to see diff noise obscuring actual code changes.
If we’re overly picky about formatting then I can see that creating a frustrating experience. However, we should provide nicely formatted code in the examples. That way learners can pick up good habits simply by copying.