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.

Inconsistancy on const Naming Cases

See original GitHub issue

Affected pages

Previous Lesson: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword

Your code

/*
  Change the 0 so that sum will equal 20.
*/

const SUM = 10 + 10;


Expected behavior

Correctionr: Extract: On lesson 10 from the JavaScript curriculum all caps constants are referred as the “common practice” and there after several times this “common practice” is not followed. Does it deserves to change lesson 10 text to limit this convention to a certain kind of constants or should other lessons be updated to follow this “common practice”.

<del datetime="Tue Feb 15 2022 21:23:56 GMT+0000" title="deleted Tue Feb 15 2022 21:23:56 GMT+0000 (Western European Standard Time)">As explained on previous lesson all const should be named ALLCAPS “…variables declared with const to conform to common practices, meaning constants should be in all caps.” “const sum” according to previous lesson should be rewritten to “const SUM”</del>

Screenshots

System

  • Device: Desktop
  • OS: Manjaro Linux 21.2.3 “Qonos”
  • Browser: Firefox
  • Version: 97.0 (64 bits)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
ls-madhucommented, Feb 16, 2022

@Jagruti1610 Yes, you can make a Pull Request.

1reaction
ShaunSHamiltoncommented, Feb 15, 2022

If we do anything, I would change this line:

Also, rename variables declared with const to conform to common practices, meaning constants should be in all caps.

To

Also, rename variables declared with const to conform to common practices.

And maybe remove this:

A common practice when naming constants is to use all uppercase letters, with words separated by an underscore.


How would you feel about removing the note?

The note is spot-on, in my opinion.

Note: It is common for developers to use uppercase variable identifiers for immutable values and lowercase or camelCase for mutable values (objects and arrays). You will learn more about objects, arrays, and immutable and mutable values in later challenges. Also in later challenges, you will see examples of uppercase, lowercase, or camelCase variable identifiers.

Especially our declaration of:

Also in later challenges, you will see examples of uppercase, lowercase, or camelCase variable identifiers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why aren't constants all in upper-case in .Net? - Stack Overflow
Microsoft naming conventions for .Net put constants in Pascal Case. In fact, it explicitly tells us to avoid using all caps for constants:....
Read more >
Does the inconsistency in naming conventions in C++ bother ...
Multiple naming styles really does not bother me. I do get irritated with libraries that have non-standard iterators and containers.
Read more >
Inconsistency between classic StyleCop and ... - GitHub
This is an interesting deviation from StyleCop Classic. The url declaration is a local constant, which is technically not a field.
Read more >
Naming convention (programming) - Wikipedia
In computer programming, a naming convention is a set of rules for choosing the character sequence to be used for identifiers which denote...
Read more >
Best coding practices - AutoIt Wiki
1 Using Functions · 2 Names of Variables · 3 Variable Initialization · 4 Scopes of Variables · 5 Const, Static, Enum. 5.1...
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