Transcript from the "Coding Conventions" Lesson
[00:00:00]
>> Brian Holt: Something else I want to say here, so that people can get frustrated by. There's things that are called keywords in JavaScript. In other words, things that I cannot call my variable. So if I try and call this var, right, it's going to say, I don't know what that is.
[00:00:13]
You're trying to declare variable or I can say const let, or const const. So I can't have a variable called const, right? Because that confuses JavaScript. So there's a whole slew of those, like class is another one or for. It's kind of a minefield [LAUGH]. Or with, that's another one that people don't expect.
[00:00:34]
Anyway, that's another one that you should be aware of okay.
>> Brian Holt: So you can actually have this be multiple layers deep. So I could have const monthsInAYear = 12. And then here, instead of doing this, I could just put that there. So that makes sense, yearlyRent = monthlyRent times monthsInAYear.
[00:01:05]
And often, because as far I know there's no plan to change how many months there are in a year, right? This'll never be reassigned to something else, this would be considered a constant. So you can put this in what's called screaming case.
>> Brian Holt: MONTHS_IN_A_YEAR, they call it a screaming case cuz, obviously, it's all in capital letters.
[00:01:29]
And this is just to let you know, this is a constant, this is just a fixed value that will never change. Now, there's nothing special about this. I'm just showing you that this is a convention we choose to adhere to. And it just lets people know, here's this constant that we have.
[00:01:45]
And that's what it means, right? Does that make sense?