Keep magic numbers out of your code base
————
🤑 Patreon https://www.patreon.com/webdevjunkie
🔔 Newsletter http://eepurl.com/hnderP
💬 Discord https://discord.gg/4kGbBaa
📁. GitHub https://github.com/codyseibert/youtube
Keep magic numbers out of your code base
————
🤑 Patreon https://www.patreon.com/webdevjunkie
🔔 Newsletter http://eepurl.com/hnderP
💬 Discord https://discord.gg/4kGbBaa
📁. GitHub https://github.com/codyseibert/youtube
You must be logged in to post a comment.
Im new to programming and idk JS at all but this looks almost the exact same as c++
CSS variables use the same concept
It's could be more practical if you use a dictionary? Like this:
const PAYMENT_AMOUNT = {
MIN: 1.99,
MAX: 5.99
};
if(payment > PAYMENT_AMOUNT.MAX) ….
What linter/js extension do you use?
Thank you very much!! I love this short tutorial. You explain thing very well and easy to understand. Thank you again. Have an awesome weekend!!
Why did you use all-caps characters for your variable?
What's your Color theme & font name?
We maintain these in constants.js file
Good job love!!!
this is coding standard for js, as well as every variable based language, good video tho!
In short, you just never want to have anything, that may repeat elsewhere, or has an inapparent meaning, hardcoded without making use of constant values.
Way neat that way
Which do you use? It's give proper error and hints..
Can you please tell me
This is awesome. Thanks 🙂
Nice video but I think you should go in to more complex cases. This is very basic.
This mechanism is used almost everywhere. We create a Constants.cs file in C# where in we put all the constants. Also we create enums to make things cleaner.
I really need help with JavaScript 😂😂
Just recently learnt to use a variable and now I have a better understanding with this
Love the content