1/18
computer science notes/review
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
variable definition
named container for storing data
____ is stored in RAM, so it is volatile
variable
variable is stored in _____, so it is volatile
RAM
Variable is used to store info to be _____/______
referenced/manipulated
____ make code reusable/dynamic
variable
How do you do camelCase?
1st var letter lowercase
2nd var word uppercase
Variables cannot start with a _____ or _______.
number ; special character
Why should names be descriptive & consistent?
so you & other ppl understand it
Use ‘let’ when ___________.
variables can be reassigned
use ‘const’ when _______
variables CANNOT be reassigned
Avoid using var because its _____ and ______
function-scoped; older
Global scope definition
access anywhere in code
Avoid ___ Scope for functions
Global Scope
What are cons of Global Scope?
wide use—> forget what code does —> bugs
Local Scope definition
declared inside functions/blocks
Block Scope definition
declare variable within blocks/functions
RW: What keyword should you use to declare a variable that can be changed?
‘let’ keyword
RW: True or False: The following variable name is valid in JS: 6shooter
False; invalid b/c begins with # instead of letter
RW: True or False: A “const” variable must be initialized when declared.
True; you have to give it a value right away or it wont work