question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove Style Note

See original GitHub issue

https://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

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes

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:closed
  • Created a year ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
raisedadeadcommented, Mar 31, 2022

Thanks for the thoughts @jeremylt & @bbsmooth

Here is what we should do:

  1. Remove the note. IMHO you all are correct in assuming it does nothing other than draw attention to a confusing notion.
  2. We should support the technically correct syntax (ignore testing for it, if we are).
  3. Autoformatting may be a good idea, but I am afraid of accidentally introducing something else.
1reaction
ojeytonwilliamscommented, Mar 30, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add and remove styles from the Quick Styles gallery
On the Home tab, in the Styles group, right-click the style that you want to remove from the gallery. Click Remove from Style...
Read more >
Removing Style
From the submenu, select the style command that you want to remove. For example, if you want to remove the emphasis style command...
Read more >
How can I remove a style added with .css() function?
css('color', '') — removes that property from an element if it has already been directly applied, whether in the HTML style attribute, through ......
Read more >
remove-style - npm
A Note On the "rs-" Prefix​​ In order to prevent class names collision with existing class names, Remove-Style prefix class names with "rs-"....
Read more >
How to reset/remove CSS styles for element ? - GeeksforGeeks
But manual styles cannot be applied until the default styles are removed. Hence we apply the following code to remove the default styles...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found