Variables
Keyword: let, var
Starts with _ $ letter
Can't be started with number
a
account
account_100
accountNumber (Camelcase)
_accountNumber (Private Variable)
let keyword(Scope Local Variable)
var keyword(Global Variable)
Constants
Keyword: const
Constants can't be changed
Error :
const price = 40;
price = 50;
if you are unsure about when to set variable or constant, then constant first and later change it to variable. a variable that will not be changed should be constant.
avoid var keyword
'Study > Coding' 카테고리의 다른 글
Objects (0) | 2020.02.17 |
---|---|
Functions (0) | 2020.02.12 |
Program Flow (0) | 2020.02.12 |
Types and Operators (0) | 2020.02.07 |
File의 두가지 형식, Binary / Text (0) | 2018.11.02 |